Lookup to Contract object on Opportunity is showing empty value

  • 1
  • Question
  • Updated 1 year ago
  • Answered
I have a lookup field on opportunity to contract object. Contract object does not use normal Name field for lookup. I am trying to get ContractNumber which is Auto Number from contract to opportunity. IT works fine on salesforce but on skuid it does not show any value. Strange when go click this field there is an ID there but it does not show unless I click on this field. Since it is a lookup field I want the contractnumber in link format so that if I click on it, it should go to that contract. 

Any help appreciated. 
Photo of Muhammad

Muhammad

  • 100 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Can you provide the XML for the page?
Photo of Muhammad

Muhammad

  • 100 Points 100 badge 2x thumb
Thank you for looking into this. Appreciate it.
The xml where I used the default:
First XML where Name is used:            


<field id="Main_Contract__c" overridemetadata="false" ogdisplaytype="REFERENCE" displaytype="REFERENCE" datasource="salesforce" defaultvaluetype="fieldvalue">
                    <batchfields/>
                </field>
                <field id="Main_Contract__r.Name"/>

Second XML where ContractNumber is used:


   <field id="Main_Contract__c" overridemetadata="false" ogdisplaytype="REFERENCE" displaytype="REFERENCE" datasource="salesforce" defaultvaluetype="fieldvalue">
                    <batchfields/>
                </field>
                <field id="Main_Contract__r.ContractNumber"/>



In both situation the page appears as blank value






When I click on the field then it appears that there is a value in it. But it id of that contract. What I want is the url link also with the contractNumber. 


(Edited)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
XML for the whole page.
Photo of Muhammad

Muhammad

  • 100 Points 100 badge 2x thumb
Here is a new page I constructed that is showing the same issue:
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="Oppty" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Opportunity" doclone="">
            <fields>
                <field id="AccountId"/>
                <field id="Account.Name" overridemetadata="true" ogdisplaytype="STRING" displaytype="TEXT"/>
                <field id="PartnerAccount.Name"/>
                <field id="PartnerAccountId"/>
                <field id="Main_Contract__c"/>
                <field id="Main_Contract__r.Name"/>
                <field id="Parent_Opportunity__c"/>
                <field id="Parent_Opportunity__r.Name"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <tabset rememberlastusertab="true" defertabrendering="true" uniqueid="sk-1kOAR7-96" renderas="">
            <tabs>
                <tab name="Details">
                    <components>
                        <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Oppty" buttonposition="" uniqueid="sk-1kPvTn-208" mode="read">
                            <columns>
                                <column width="100%">
                                    <sections>
                                        <section title="Section A" collapsible="no">
                                            <fields>
                                                <field id="AccountId" valuehalign="" type=""/>
                                                <field id="Parent_Opportunity__c"/>
                                                <field id="Main_Contract__c"/>
                                            </fields>
                                        </section>
                                    </sections>
                                </column>
                            </columns>
                        </basicfieldeditor>
                    </components>
                </tab>
            </tabs>
        </tabset>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>



The screen shot is: You can see there is nothing in Main Contract. If I click on it, 
it does show the id of the contract. But what I need is a url link as Parent Opportunity is showing
(Edited)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Here you go. Display and Search Template on the field corrects the issue.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="Oppty" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Opportunity" doclone="">
            <fields>
                <field id="AccountId"/>
                <field id="Account.Name" overridemetadata="true" ogdisplaytype="STRING" displaytype="TEXT"/>
                <field id="PartnerAccount.Name"/>
                <field id="PartnerAccountId"/>
                <field id="Main_Contract__c"/>
                <field id="Main_Contract__r.Name"/>
                <field id="Parent_Opportunity__c"/>
                <field id="Parent_Opportunity__r.Name"/>
                <field id="Main_Contract__r.ContractNumber"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <tabset rememberlastusertab="true" defertabrendering="true" uniqueid="sk-1kOAR7-96" renderas="">
            <tabs>
                <tab name="Details">
                    <components>
                        <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Oppty" buttonposition="" uniqueid="sk-1kPvTn-208" mode="read">
                            <columns>
                                <column width="100%">
                                    <sections>
                                        <section title="Section A" collapsible="no">
                                            <fields>
                                                <field id="AccountId" valuehalign="" type=""/>
                                                <field id="Parent_Opportunity__c"/>
                                                <field id="Main_Contract__c" valuehalign="" type="" optionsource="" pagesize="5" displaytemplate="{{ContractNumber}}" searchtemplate="{{ContractNumber}}">
                                                    <searchfields/>
                                                </field>
                                            </fields>
                                        </section>
                                    </sections>
                                </column>
                            </columns>
                        </basicfieldeditor>
                    </components>
                </tab>
            </tabs>
        </tabset>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of Muhammad

Muhammad

  • 100 Points 100 badge 2x thumb
Thanks a lot. This is awesome. Really appreciate it. I wish you could also explain why I had to use {{ContractNumber}} in Display and Search Template. Why it did not happen automatically. Does that mean, the objects where the lookup is not related with Name, I would have to do  the same?. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
All lookups by default use the Name field by default on the referenced object without actually showing it Display and Search Template. Doing what we did overrode that.