liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<apex:page standardController="Agency_Opportunity__c" extensions="NewAndEditAgencyOpportunityController" id="page" lightningStylesheets="true">
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" />
    <!-- <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> -->
    <apex:slds />
    <div class="slds-scope">
        <apex:form id="form">
            <apex:pageblock id="pageBlock">
                <div class="slds-box slds-theme_default">
                    <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection">
                    <apex:outputField html-data-id="Agency_Contact__c" title="{!ApiPrefix}Agency_Contact__c" value="{!Agency_Opportunity__c['Agency_Contact__c']}"
                    />
                    </apex:pageBlockSection>
                </div>
                
                <script>
                    var staticAgencyContactResources = JSON.parse('{!staticAgencyContactResources}');
 
                    function QuerySobjectFromAWS() {
                        let t = "[title='" + '{!ApiPrefix}' + "Agency_Contact__c']";
                        let ele = document.querySelector(t);
                        if ('{!agencyContactAWSId}' != '无') {
                            if ('{!agencyContactAWSId}' != '') {
                                AWSService.query(staticAgencyContactResources.queryUrl, '{!agencyContactAWSId}', queryAgencyContactBack, staticAgencyContactResources.token);
                            }
                        } else {
                            ele.innerHTML = '';
                        }
                    }
 
                    var queryAgencyContactBack = function queryAgencyContactBack(data) {
                        if (!data.object) {
                            console.log('data.object is ' + data.object);
                            return;
                        }
                        console.log('data is ' + data.object);
 
                        let t = "[title='" + '{!ApiPrefix}' + "Agency_Contact__c']";
                        let ele = document.querySelector(t);
                        if (ele) {
                            ele.title = '';
                            ele.innerHTML = data.object.name;
                        }
 
                    };
 
                    sfdcPage.appendToOnloadQueue(function () {
                        console.log('sfdcPage.appendToOnloadQueue');
                        debugger
                        QuerySobjectFromAWS();
                    });
                </script>
            </apex:pageblock>
        </apex:form>
    </div>
 
</apex:page>