Button actions not working 1) create new row 2) update fields on diff model

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am doing a Survey tool integration off my contact page.  I've created a custom object "SurveyResults" to store the results that has a lookup back to my Contact object.  My users will click a "New Survey" button on the Contact page to initiate the survey, which will 1) Create a new row in my SurveyResults model (sets the contact relationship but has an empty 'score' until the response is received from the customer) 2) Set a 'Send Survey' checkbox on the Contact model to TRUE - this triggers the workflow to send an email out with the survey url 3) Set a 'SurveyID' field on the Contact model to the id of the new SurveyResults, which I use as a merge field in my emailed url to give the customer the correct survey link 4) Set 'Last Survey Date' field on the contact object so I know the last time a customer was surveyed, so we can prevent a customer from being surveyed too often.

My button is set to run multiple actions:
1) Create a new row in the SurveyResults model
2) Update Field on a Row, ContactData model, to set 'Send Survey' checkbox to TRUE
3) Update Field on a Row, ContactData model, to set 'Last Survey Date' to TODAY
4) Save models - Survey Results, Contact Data
Only action for #1 above works - the new SurveyResults record gets created and Saved.  The 2 Contact fields do not get updated.
** I have not attempted the SurveyID field on the ContactData model since I can't get the others working.

Any idea what I am doing wrong here? Thanks!
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Your listed actions doesn't mention "3) Set a 'SurveyID' field on the Contact model to the id of the new SurveyResults"
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Pat - thanks for responding.  I'm not sure I understand your suggestion.  The Survey record is a child of the Contact.  Where would I need to set the Survey id on the contact?  I've included a screen shot of the user side.  The SurveyResults is a related list under the Contact.

Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Well you discussed that you set the surveyID on the ContactData model, but don't have an action doing this.

Also, this workflow you've got. Does it clear these values?
- Send Survey
- Last Survey Date
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Yes, I haven't added the surveyID field set yet ... that seems harder to get the new record ID passed over, so I wanted to get the easy stuff working first.
The workflow will clear the SendSurvey checkbox after a set period of time (maybe quarterly it will reset to False, and the contact will be eligible to re-survey.)  I envision the Last Survey Date will not clear, it will be overridden each time a survey is sent out.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Just to make sure you have access to edit and save these fields, can you do so through inline editing and the save button?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
I do... yes, I have been manually triggering the checkbox to test the survey integration side.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
hmmmm... remove ContactData from the save action and look to see if the fields get changed. Those buttons on the field editor will be enabled if the row has en edit pending saving. That might be a clue.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Chandra.  Would you mind granting login rights to Skuid?  Here are some instructions

Then send an email to Support@skuidify with your ORG ID and the page you are building. 

We'll take a closer look. 
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Rob - in giving you access rights, it dawned on me to check my version in this sandbox, and I was on an old version.  Upgraded and presto - it is working!!  That brings me to my next problem... passing the SurveyResults record id to a field on the Contact page so I can then merge it into my email template.  I tried to use another Update field action on my button, but that field isn't updating.

Email coming to you with access rights...

Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
oh oh ... the merge field syntax is wrong. It needs to be something like {{$Model.AFLSurvey.data.0.Id}}
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
And I'm not sure this would work until after the survey is saved.
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Progress!!  I tried your syntax, Pat, and it loaded '4' for my id.  Not a record id, but at least it is something.  So then I added a model save action after survey creation in the button and tried again, and I got a '5' in there this time.  Still not the id... humph
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Is the id in your survey model?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Yes
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
er ... uh .. the surveyid field on the contact increments by one. What kind of field is it?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
hahaha... I put nothing past myself.  But it is Text(25)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Ok. You create the row in the Survey model and save it, then have a field update on the contact model?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
yes, exactly
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Did Skuid folks get it working?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
No... not yet. I provided access rights yesterday but haven't heard anything back from them yet.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Sometimes I wish could get the same access. :D
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Looks like you got this working,  and I'm sorry for not getting back to you sooner.  Here is what is going on. 

When you create a row on the model,  Skuid is just creating that client side - and does not yet have the true Salesforce Record Id.  So we provide a protoId,  usually a single digit number. This allows conditions that go acrross models to stay in synch. 

When you save this row to the database.  Salesforce assigns the record ID (long 18 char number) and then Skuid goes back and replaces the protoId with a real Id wherever it is needed. 

So if you had the "Update field in row" action occuring before the model saved - you just passed '4' or '5' as you state above.  But if you move it after the model save, you get the results you want. 

Another note about your use of ID for the Emailed URL.  You should look at the URL that is expected by your survey tool.  It may be 15 or 18 characters.  Skuid defaults to the use of the 18 character ID.  But if your URL really should be the 15 char ID use  'Id15' in your merge syntax. 
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Hi Rob, thanks for responding.  I do have a Save action in my multi actions before the field updates, but still not getting the record id.  I'm only getting the single digit value.  My multi actions are:
1) Create new record in AFLSurvey
2) Save model AFLSurvey
3) Update contact field - 'SendSurvey' checkbox (working)
4) Update contact field - 'LastSurveyDate' (working)
5) Update contact field - SurveyMerge - not working.   Using merge syntax {{$Model.AFLSurvey.data.0.Id}} .  Is this right?
6) Save models - ContactData, AFLSurvey

And my survey integration is using the 18 digit id, so I'm good there!  I just need to get it on my Contact field so I can merge it into my email template!
Chandra
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
When I tested within your org I got the 18 digit value populated in the contact record fields below the survey table.   Can you double check? 
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
err... well, GREAT!!  Feel free to take credit, Rob!  ;)  Thanks for looking, and sorry I am blind!