UI Only field Input in an Action Sequence to update a different Model

edited April 13, 2019 in Questions
Probably a very simple question but I can't get this to work. I have a UI only model (a survey with about 10 questions, all ui only fields) and I am trying to launch an action sequence with a button that will take those survey answers provided by the user and update the fields in an account model (with only one row) with correct values. So when the user clicks the "Finish and Submit" button, I need to grab the UI text field ContactNameUI and update the ContactName text field in the Account model. 

FYI I created an Input in the action sequence with type = Model Field and the sequence runs, but all it's doing is updating the ContactName field on the Account with the name of the ui field, NOT the value provided by the user.  

Comments

  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN 💎💎💎
    edited April 12, 2019
    Hi Olya,

    So, the Action Sequence Input should just be of type "Value", not "Model Field". What "Model Field" means is that the Input value is expected to be a Field Id, e.g. "ContactName". So in your case, change the Input type to "Value".

    Then, in an Update Row action, you can use "Single specified value" as the Value Source and then use "{{$Input.contactName}}", or whatever the input's name is, to grab the value and use that to update a model row's value.

    image

    image
  • edited April 12, 2019

    Hi Zach,

    I tried following your instructions but the action sequence is still wiping out the existing data in the field instead of passing in the new value. The action sequence that I am using is a Reusable type and, even though I set the Input as a Value and used the merge syntax in the Action Sequence itself, when I include that Action Sequence as one of the actions launched by a button (Run Multiple Actions button), I have to set the value again. How and where do I point these Inputs to the correct UI Model fields? Right now they are not referencing a specific model …

    Thanks!

    Olya
  • edited April 12, 2019

  • edited April 12, 2019

  • edited April 12, 2019

  • Bill McCulloughBill McCullough 💎💎
    edited April 13, 2019
    Olya,

    Here is a sample page that uses a UI Only model and a Task model to demonstrate using the action sequence.  I think where you were missing the step to set the input value when you ran the action sequence from the button.

    This was built using Skuid version 12.0.11 (Spark) using API V1.  It should work in version 11 (Millau).

    Thanks,

    Bill

    <skuidpage personalizationmode="server" showsidebar="true" showheader="true">
    <models>
    <model id="UIOnlyForm" limit="1" query="true" createrowifnonefound="true" datasource="Ui-Only" processonclient="true">
    <fields>
    <field id="taskNameUi" displaytype="TEXT" label="Name"/>
    </fields>
    <conditions/>
    <actions/>
    </model>
    <model id="NewTask" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Task">
    <fields>
    <field id="Id"/>
    <field id="Subject"/>
    </fields>
    <conditions/>
    <actions/>
    </model>
    </models>
    <components>
    <grid uniqueid="sk-MsO-254" columngutter="4px">
    <divisions>
    <division behavior="flex" minwidth="100px" ratio="1">
    <components>
    <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="UIOnlyForm" uniqueid="sk-Mrs-143" mode="edit">
    <columns>
    <column width="100%" uniqueid="sk-Mrs-139">
    <sections>
    <section title="Enter Name  - UI ONLY Model" uniqueid="sk-Mrs-140" collapsible="no">
    <fields>
    <field uniqueid="sk-Mrs-144" id="taskNameUi"/>
    </fields>
    </section>
    </sections>
    </column>
    </columns>
    </basicfieldeditor>
    </components>
    </division>
    <division behavior="flex" verticalalign="top" minwidth="100px" ratio="1">
    <components>
    <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="NewTask" uniqueid="sk-MsU-289" mode="edit">
    <columns>
    <column width="100%" uniqueid="sk-MsU-285">
    <sections>
    <section title="Task Model" uniqueid="sk-MsU-286" collapsible="no">
    <fields>
    <field uniqueid="sk-MsU-291" id="Id"/>
    <field uniqueid="sk-MsU-292" id="Subject"/>
    </fields>
    </section>
    </sections>
    </column>
    </columns>
    </basicfieldeditor>
    </components>
    </division>
    </divisions>
    <styles>
    <styleitem type="background" bgtype="none"/>
    </styles>
    </grid>
    <buttonset model="NewTask" uniqueid="sk-MsN-249" position="left">
    <buttons>
    <button type="multi" label="Run Action Sequence to Update" uniqueid="sk-Msa-325">
    <actions>
    <action type="action-sequence" action-sequence-id="5e20c2a5-c352-4067-b9c2-29993695705d">
    <inputs>
    <input name="newName" value="{{$Model.UIOnlyForm.data.0.taskNameUi}}"/>
    </inputs>
    </action>
    </actions>
    </button>
    <button type="multi" label="Copy Name from Form to New Task Model" uniqueid="sk-Mtt-414">
    <actions>
    <action type="updateRow" fieldmodel="NewTask" affectedrows="context">
    <updates>
    <update valuesource="fieldvalue" field="Subject" enclosevalueinquotes="true" value="{{$Model.UIOnlyForm.data.0.taskNameUi}}"/>
    </updates>
    </action>
    </actions>
    </button>
    <button type="multi" label="Clear Name on New Task Model" uniqueid="sk-Mux-538">
    <actions>
    <action type="updateRow" fieldmodel="NewTask" affectedrows="context">
    <updates>
    <update valuesource="blank" field="Subject" enclosevalueinquotes="true"/>
    </updates>
    </action>
    </actions>
    </button>
    </buttons>
    </buttonset>
    </components>
    <resources>
    <labels/>
    <javascript/>
    <css/>
    <actionsequences uniqueid="sk-Mro-111">
    <actionsequence id="5e20c2a5-c352-4067-b9c2-29993695705d" label="UpdateAccount" type="reusable">
    <description/>
    <actions>
    <action type="updateRow" fieldmodel="NewTask" affectedrows="context">
    <updates>
    <update valuesource="fieldvalue" field="Subject" enclosevalueinquotes="true" datasource="salesforce" userinfotype="userid" value="{{$Input.newName}}"/>
    </updates>
    </action>
    </actions>
    <inputs>
    <input type="value" name="newName"/>
    </inputs>
    </actionsequence>
    </actionsequences>
    </resources>
    <styles>
    <styleitem type="background" bgtype="none"/>
    </styles>
    </skuidpage>

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!