Help With difference between Navigation Bar and Button Set

  • 1
  • Question
  • Updated 1 year ago
  • In Progress
Hi All,

  I am pretty new to using Skuid, 
I am trying to select bunch of contacts and sending them to new custom object to Tag them as key contact.
I was able to configure that very successfully using Navigation Action Frame.
Since that is not very appealing I tried same action frame with button, but in 
, instead of creating multiple rows it always pass first contact I chose.
help..
Photo of Sangeetha

Sangeetha

  • 186 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,442 Points 2k badge 2x thumb
If you post the XML for your page it would help to pinpoint, but it looks like you're dealing with a context issue.  Buttons are usually tied to a model, and it looks like you're context is off and when context isn't set correctly it will pull the first row.  There are different configuration points for defining context depending on the component in use.
Photo of Sangeetha

Sangeetha

  • 186 Points 100 badge 2x thumb
Hi John 
  Thanks for getting back to me,
here is my XML

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">    <models>
        <model id="KeyContact" limit="" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact_Detail__c" doclone="">
            <fields>
                <field id="Name"/>
                <field id="Notes__c"/>
                <field id="Id"/>
                <field id="Related_Account__c" overridemetadata="false" ogdisplaytype="REFERENCE" displaytype="REFERENCE" datasource="salesforce" defaultvaluetype="modelmerge" defaultValue="" model="ContactsfromAccount" enclosevalueinquotes="true" mergefield="Related_Account__c" fieldtargetobjects="Account" picklistsource="rowsinmodel" picklistmodel="Contact" entryvalue="{{ AccountId}}">
                    <batchfields/>
                </field>
                <field id="Related_Account__r.Name"/>
                <field id="Sentiment__c"/>
                <field id="Title__c"/>
                <field id="Services_Key_Contact__c"/>
                <field id="Sales_Key_Contact__c"/>
                <field id="Security_Key_Contact__c"/>
                <field id="Marketing_Key_Contact__c"/>
                <field id="Contact_Title__c"/>
                <field id="Functional_Area__c"/>
                <field id="Key_Contact__c"/>
                <field id="Key_Contact__r.Name"/>
                <field id="Sentiment_Reason__c"/>
                <field id="Other_Reason__c"/>
                <field id="Key_contact_name__c"/>
                <field id="Key_Contact_Status__c"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Related_Account__c" fieldtargetobjects="Account" operator="=" enclosevalueinquotes="true" novaluebehavior="" state="" inactive="false"/>
            </conditions>
            <actions>
                <action>
                    <actions>
                        <action type="updateRow" fieldmodel="KeyContact" affectedrows="context" field="Account__c" fieldtargetobjects="Account" enclosevalueinquotes="true" value="{{$Model.Contact.data.0.AccountId}}"/>
                    </actions>
                    <events>
                        <event>row.created</event>
                    </events>
                </action>
            </actions>
        </model>
        <model id="Contact" limit="" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
            <fields>
                <field id="AccountId"/>
                <field id="Account.Name"/>
                <field id="Id"/>
                <field id="Name"/>
                <field id="Title"/>
                <field id="Support_Relationship__c"/>
                <field id="No_Longer_w_Company__c"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="AccountId" fieldtargetobjects="Account" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
                <condition type="join" value="" field="Id" operator="not in" mergefield="Key_Contact__c" novaluebehavior="deactivate" fieldtargetobjects="Contact" enclosevalueinquotes="true" joinobject="Contact_Detail__c" joinfield="Key_Contact__c" logic=""/>
                <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="No_Longer_w_Company__c" operator="!="/>
            </conditions>
            <actions/>
        </model>
        <model id="WorkdayRelationship" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Workday_Relationship__c" doclone="">
            <fields>
                <field id="Key_Contact__c" overridemetadata="true" ogdisplaytype="REFERENCE" displaytype="REFERENCE" datasource="salesforce">
                    <batchfields/>
                </field>
                <field id="Key_Contact__r.Name"/>
                <field id="Relationship_Owner__r.Name"/>
                <field id="Relationship_Owner__c"/>
                <field id="Relationship_Owner_Role__c"/>
                <field id="Relationship_Type__c"/>
                <field id="Key_Contact__r.Related_Account__c"/>
                <field id="Key_Contact__r.Related_Account__r.Name"/>
                <field id="Last_Communication_Date__c"/>
                <field id="Last_Validated_Date__c"/>
                <field id="Relationship__c"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Key_Contact__r.Related_Account__c" fieldtargetobjects="Account" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
                <condition type="modelmerge" value="" field="Key_Contact__c" fieldtargetobjects="Contact_Detail__c" operator="=" model="KeyContact" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <navigation uniqueid="sk-xcoyN-550" allowexpandcollapse="false">
            <navigationitems>
                <navigationitem label="Tag Key Contact" uniqueid="sk-xhh6P-929" icon="sk-icon-partners">
                    <actions>
                        <action type="blockUI"/>
                        <action type="requeryModel" model="KeyContact" behavior="standard"/>
                        <action type="showPopup">
                            <popup title="Select Contacts" width="90%">
                                <components>
                                    <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="false" model="Contact" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-xi27r-971">
                                        <fields>
                                            <field id="Name" hideable="true" uniqueid="fi-xiMZd-1029"/>
                                            <field id="Title" hideable="true" uniqueid="fi-xiMZd-1030"/>
                                            <field id="Support_Relationship__c" hideable="true" uniqueid="fi-xiMZe-1031"/>
                                        </fields>
                                        <rowactions/>
                                        <massactions usefirstitemasdefault="true">
                                            <action type="multi" label="Select Contacts">
                                                <actions>
                                                    <action type="createRow" model="KeyContact" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
                                                        <defaults>
                                                            <default type="fieldvalue" field="Key_Contact__c" fieldtargetobjects="Contact" enclosevalueinquotes="true" value="{{Id}}"/>
                                                        </defaults>
                                                    </action>
                                                    <action type="closeAllPopups"/>
                                                </actions>
                                            </action>
                                        </massactions>
                                        <views>
                                            <view type="standard"/>
                                        </views>
                                        <conditions/>
                                    </skootable>
                                </components>
                            </popup>
                        </action>
                        <action type="unblockUI"/>
                    </actions>
                    <renderconditions logictype="and"/>
                </navigationitem>
                <navigationitem label="Back To Account" uniqueid="sk-xiVvy-1051">
                    <actions>
                        <action type="redirect" window="blank" url="https://workday--qa--c.cs23.visual.force.com/apex/TabbedAccountPage?srPos=0&amp;srKp=001&amp...= {{Related_Account__c}}" model="KeyContact" behavior="standard"/>
                    </actions>
                </navigationitem>
            </navigationitems>
            <styles/>
            <renderconditions logictype="and"/>
        </navigation>
        <buttonset uniqueid="sk-i4vzq-460" model="Contact" position="center">
            <buttons>
                <button type="multi" label="Tag Key Contact" uniqueid="sk-i4wbs-466" icon="sk-icon-partners">
                    <actions>
                        <action type="blockUI" window="blank" url="https://workday--qa.cs23.my.salesforce.com/{{Related_Account__c}}"/>;
                        <action type="requeryModels" model="KeyContact" behavior="standard">
                            <models>
                                <model>KeyContact</model>
                                <model>Contact</model>
                            </models>
                        </action>
                        <action type="showPopup">
                            <popup title="Key Contact Selection" width="90%">
                                <components>
                                    <pagetitle uniqueid="sk-wprv4-478" model="Contact">
                                        <maintitle>Select  Contact to Add as Key Contact</maintitle>
                                        <subtitle>
                                            <template>{{Model.label}}</template>
                                        </subtitle>
                                        <actions/>
                                        <renderconditions logictype="and"/>
                                        <conditions/>
                                    </pagetitle>
                                    <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="false" model="Contact" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-wp_DA-490" emptysearchbehavior="query" allowscrollbars="true" tablescrollheight="300px" floatheader="true">
                                        <fields>
                                            <field id="Name" hideable="true" uniqueid="fi-wqDL--520" valuehalign="" type=""/>
                                            <field id="Title" hideable="true" uniqueid="fi-wqFEx-527"/>
                                            <field id="Support_Relationship__c" hideable="true" uniqueid="fi-wqHD9-534" selectedlist="3" valuehalign="" type=""/>
                                        </fields>
                                        <rowactions/>
                                        <massactions usefirstitemasdefault="true">
                                            <action type="multi" label="Select Contacts" icon="">
                                                <actions>
                                                    <action type="createRow" model="KeyContact" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
                                                        <defaults>
                                                            <default type="fieldvalue" field="Key_Contact__c" fieldtargetobjects="Contact" value="{{Id}}" operator="=" enclosevalueinquotes="true"/>
                                                        </defaults>
                                                    </action>
                                                    <action type="closeAllPopups"/>
                                                </actions>
                                                <hotkeys/>
                                            </action>
                                        </massactions>
                                        <views>
                                            <view type="standard"/>
                                        </views>
                                        <searchfields/>
                                        <renderconditions logictype="and"/>
                                        <conditions/>
                                        <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true">
                                            <action type="multi" label="Run multiple actions" icon="sk-icon-magic">
                                                <actions>
                                                    <action type="createRow" model="KeyContact" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
                                                        <defaults>
                                                            <default type="fieldvalue" field="Key_Contact__c" fieldtargetobjects="Contact" enclosevalueinquotes="true" value="{{Id}}"/>
                                                        </defaults>
                                                    </action>
                                                    <action type="closeAllPopups"/>
                                                </actions>
                                            </action>
                                        </actions>
                                    </skootable>
                                </components>
                                <afterclose/>
                            </popup>
                        </action>
                        <action type="unblockUI"/>
                    </actions>
                    <hotkeys/>
                    <renderconditions logictype="and"/>
                    <enableconditions/>
                </button>
                <button type="multi" label="Back To Account" uniqueid="sk-wocdm-443">
                    <actions>
                        <action type="redirect" window="blank" url="https://workday--qa--c.cs23.visual.force.com/apex/TabbedAccountPage?srPos=0&amp;srKp=001&amp...;
                    </actions>
                </button>
                <button type="multi" label="Back To Customer 360" uniqueid="sk-i9YM_-490">
                    <actions>
                        <action type="redirect" window="blank" url="https://workday--qa.cs23.my.salesforce.com/apex/Customer360SummaryPage?Id ={{AccountId}}"/>
                    </actions>
                    <hotkeys/>
                </button>
            </buttons>
            <renderconditions logictype="and"/>
        </buttonset>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="100" alwaysresetpagination="false" createrecords="true" model="KeyContact" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-3eM794-224" emptysearchbehavior="query" allowscrollbars="true" tablescrollheight="550px" floatheader="true">
            <fields>
                <field id="Key_Contact__c" hideable="true" uniqueid="fi-x4WRE-221" valuehalign="" type="" readonly="true"/>
                <field id="Related_Account__c" hideable="true" uniqueid="fi-3eTkvJ-1808" valuehalign="" type="" readonly="true"/>
                <field id="Services_Key_Contact__c" hideable="true" uniqueid="fi-3kI_sr-560" type="" valuehalign=""/>
                <field id="Sales_Key_Contact__c" hideable="true" uniqueid="fi-3kIoFW-533" type="" valuehalign=""/>
                <field id="Marketing_Key_Contact__c" hideable="true" uniqueid="fi-3kIoFV-532" type="" valuehalign=""/>
                <field id="Key_Contact_Status__c" hideable="true" uniqueid="fi-xFF-y-473" valuehalign="" type=""/>
                <field id="Sentiment__c" hideable="true" uniqueid="fi-3eMO_S-243" valuehalign="" type=""/>
                <field id="Sentiment_Reason__c" hideable="true" uniqueid="fi-DF0u4-524" valuehalign="" type=""/>
                <field id="Other_Reason__c" hideable="true" uniqueid="fi-hRVS--190" valuehalign="" type=""/>
                <field id="Notes__c" hideable="true" uniqueid="fi-3eMO_P-241" valuehalign="" type=""/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="drawer" label="Manage Relationship" icon="sk-icon-partners">
                    <drawer title="Drawer Area" width="90%" closehandle="true">
                        <components>
                            <grid uniqueid="sk-DLMmz-1539">
                                <divisions>
                                    <division behavior="flex" minwidth="100px" ratio="1" verticalalign="center">
                                        <components>
                                            <richtext multiple="true" uniqueid="sk-wcBTh-294" model="WorkdayRelationship">
                                                <contents>&lt;h3&gt;&lt;span style="color:#3399ff;"&gt;Manage Workday RelationShip&lt;/span&gt;&lt;/h3&gt;
</contents>
                                            </richtext>
                                            <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="WorkdayRelationship" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-DLP0C-1546" emptysearchbehavior="query" allowscrollbars="true" tablescrollheight="150px" floatheader="true" instantfilters="false">
                                                <fields>
                                                    <field id="Relationship_Owner__c" hideable="true" uniqueid="fi-DLaim-1582" valuehalign="" type=""/>
                                                    <field id="Relationship_Owner_Role__c" hideable="true" uniqueid="fi-DLaim-1583" valuehalign="" type="">
                                                        <label>Owner Role</label>
                                                    </field>
                                                    <field id="Relationship_Type__c" hideable="true" uniqueid="fi-DLain-1584"/>
                                                    <field id="Relationship__c" hideable="true" uniqueid="fi-sPc5F-214" valuehalign="" type=""/>
                                                    <field id="Last_Communication_Date__c" hideable="true" uniqueid="fi-hRtTY-267" valuehalign="" type=""/>
                                                    <field id="Last_Validated_Date__c" hideable="true" uniqueid="fi-hSpXR-206" valuehalign="" type="" readonly="true" showbydefault="true"/>
                                                </fields>
                                                <rowactions>
                                                    <action type="edit"/>
                                                    <action type="multi" label="Validate Relationship" icon="sk-icon-mark-completed">
                                                        <actions>
                                                            <action type="updateRow" fieldmodel="WorkdayRelationship" affectedrows="context" field="Last_Validated_Date__c" enclosevalueinquotes="false" value="TODAY"/>
                                                        </actions>
                                                    </action>
                                                </rowactions>
                                                <massactions usefirstitemasdefault="true"/>
                                                <views>
                                                    <view type="standard"/>
                                                </views>
                                                <searchfields/>
                                                <conditions>
                                                    <condition type="contextrow" field="Key_Contact__c" mergefield="Id" operator="=" fieldtargetobjects="Contact_Detail__c"/>
                                                </conditions>
                                                <renderconditions logictype="and"/>
                                            </skootable>
                                        </components>
                                    </division>
                                </divisions>
                                <styles>
                                    <styleitem type="background" bgtype="none"/>
                                </styles>
                            </grid>
                        </components>
                        <beforeload/>
                    </drawer>
                    <renderconditions logictype="and"/>
                </action>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="multi" label="Update Key Contacts">
                    <popup title="New Popup" width="90%">
                        <components/>
                    </popup>
                    <actions>
                        <action type="blockUI"/>
                        <action type="createRow" model="KeyContact" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context"/>
                        <action type="save" rollbackonanyerror="false">
                            <models>
                                <model>KeyContact</model>
                            </models>
                        </action>
                        <action type="unblockUI"/>
                    </actions>
                    <renderconditions logictype="and"/>
                </action>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
            <searchfields/>
            <renderconditions logictype="and"/>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
    <interactions/>
</skuidpage>
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,442 Points 2k badge 2x thumb
I'm not sure which set of components you're landing on as it looks like you're trying out several different approaches, but here are couple pointers. 

First, you have a model action that is updating the account on the contact detail table with {{$Model.Contact.data.0.AccountId}}.  This will always pick the first record from the contact model.  This may not be causing an issue at the moment given you're filtering the account via a URL parameter and the contacts should always have the same account.  However I've found that it best to avoid this first row reference unless you have a clean lineup to a known single record, avoiding surprises later.  Also there are certainly good use cases for leveraging the action framework from a model, but this probably isn't one of them.  It's better to include all the field values you need in a "Create new row(s)" action as one package. 

Second, for what I'm deciphering as your use case, I would use the mass action on your table and expand the action of creating a new row to perform the inserts into the contact detail model.  Move the account update there as well.  The mass actions will have row context for when you pick the items from your table.  While the button component can be tied to a model, it doesn't have the same row-level context for the records of interest, so it will use the first row.

Another idea is to use a row-action to perform your record update.  You can setup a similar action sequence to create new rows and then the user can click the icon on the row.  It would be one less click that way.  We do something similar to follow records with Chatter. 

In both of these cases, make sure to use the merge fields rather than the $Model parameter so you keep in context.
Photo of Sangeetha

Sangeetha

  • 186 Points 100 badge 2x thumb
Hi John,

   Thanks for the details reply, 
Here is what we are trying to do,
We want identify key contacts per account,  So when AE is click a button account, that will bring them to this page which will give them list of Key contacts for that account and able to Tag a contact as a Key contact.

To Tag them ,  They wanted click which will give them all the contacts that are related to that account, and pick the contacts as a Key contact.Those contact will be inserted to a Key contact as new rows then AE can enter more details (which is the create new rows in to the Key Contact) 
First I used Navigation component, which worked perfectly, but in they UI it didn't look that fancy,
so I tried the same scenario using a button set, which is bringing me only one row.

Thanks for your help.

 
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,442 Points 2k badge 2x thumb
I would start with using a row action to add a row to a model as mentioned above.  Once you get comfortable with context there it should be easy enough to setup a mass action.  I don't think buttons are the way to go.  Think of these as options for global actions, not mass actions.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
I think John is right, and buttons may not be best suited to see which rows your user has chosen. From what you've described, you might consider setting up a mass action on your contacts table, which will run actions to 1) adopt the selected rows into a second model and then 2) update the appropriate field on that model to mark them as Key contacts. Once you have adopted the selected contacts into the new model, you have much more freedom to make any changes to them, and it'll be easier to keep these selected rows together, and separated from the main list of contacts. 
Photo of Sangeetha

Sangeetha

  • 186 Points 100 badge 2x thumb
Thanks John/Mark,

  yes, I was able to design the Navigation component as a button that worked like a charm. 

But I have tested with row action which works as well, but I kind a like the Navigation worked.

Anyways thanks for both of your help.