Update field in wizard when another field is updated in wizard

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I've looked around for an answer to this, but can't seem to find a solution that works for me. I'm trying to update a field on the 3rd step of a wizard with data that was selected on the 2nd step of the wizard. Both are in tables.

I have a wizard that takes an existing opportunity and creates a Sales Order. On the 2nd step of the wizard, I have a lookup field called "Ship_To". The "Ship_To" field allows the user to select the shipping location from the account selected.

On the 3rd step of the wizard I have a field named "Packaging_Notes" that I'd like to update once a "Ship_To" location is selected on the 2nd step. I can't get the Packaging Notes field to update to the correct value after the Ship_To location is selected.

Can I do this with action framework or do I need to do snippet?

Thank you for any help.
Photo of Sam Becker

Sam Becker

  • 1,178 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Did you try a model action to update field on rows when your ship to field is updated?
Photo of Sam Becker

Sam Becker

  • 1,178 Points 1k badge 2x thumb
That works! But, how do I get it to update to the value from another model? I tried {{CustomerLocation.Packaging_Note__c}}, but that doesn't work.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Sam,

You may need global merge syntax. Something like this:

{{$Model.CustomerLocation.data.0.Packaging_Note__c}}

Assuming that CustomerLocation is your model and Packaging_Note__c is your field.
Photo of Sam Becker

Sam Becker

  • 1,178 Points 1k badge 2x thumb
That may work, but I can't get my CustomerLocation model to pull the correct Id from Ship_To field. I've set a condition on my CustomerLocation model Id field to match the value of the Ship_To__c field from the SalesOrder model that I'm working with.

Iv'e tried setting up my "Next Step" button to set model condition of the CustomerLocations.Ship_To field and then query the model, but when I run a skuid.model.map().CustomerLocations.getRows() in the browser console on the last step of the wizard, my CustomerLocations model still pulls the wrong iD.

I can't get it to use the Id from the Ship_To field on the second step.

Shouldn't this work? What am I doing wrong?

Thank you for your help! much appreciated.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think that's overkill.   Once you select the address value in step 2,  you have that data in your model.   You simply need to pass it into the Packaging Notes field as part of the next step button in your wizard.  The "Update field on model" action lets you update a value on any model, so that's how you get out to the other model. 

You do need to use the global merge syntax Matt references above to pass the value from your address fields.   But it is probably something like this
  {{$Model.Ship_To.Data.0.ShippingAddress.Street}}

Also it sounds like address is a reference to another object.  In this case you probably don't just want to send the ID of that reference field,  but you want to go through and actually get the values.   To do this go to the search tab of the reference field and select the specific fields you want returned when the user chooses an address.   Choose the "query values" option. This way those account fields will be in your model immediately - and you won't require a save and requery to get more than just the ID. 



Hope that helps. 
Photo of Sam Becker

Sam Becker

  • 1,178 Points 1k badge 2x thumb
Sorry, but this isn't making sense to me. I still can't get it to work and modifying the Search Fields on my Ship_To field only changed the values of the pop-up searchbox. Also, not sure what you meant by the change in the Merge Syntax as "Ship_To" is a field of the CustomerLocation model.

To be clear,
Once I select the address in step 2, which is a lookup field from my SalesOrderLineItems object to an object called "Location_Tracker"(CustomerLocation Model). The Location_Tracker object is a Master-detail relationship to the Account object. Every account has multiple Location_Tracker records to keep track of all the shipping locations of that account.

In the Wizard, when a user selects a "Ship To" location (Which I have filtered by Account.Id) and then goes to the next step. I'd like the Packaging_Note Field (on the SalesOrderLineItem model) to update to the value of the Packaging_Note field on the Location_Tracker object (CustomerLocation model).

The goal is to pre-populate the Packaging Note (and other fields on the SalesOrderLineItem) with values from the LocationTracker record associated with that Account's location.

Does the above still apply? and if so could you elaborate?

Thank you! I hope one day I can give back to this community that is so helpful.

Photo of Sam Becker

Sam Becker

  • 1,178 Points 1k badge 2x thumb
Just wanted to let you guys know I was able to figure out the initial problem with the help Raymond and Matt provided. Except I had to use 3 mustaches instead of 2 on each side. {{{}}}

However, I'm still working on solving the overall problem since the solution only applies to the first row and not each row. Right now I'm working on a Javascript Snippet that will do this.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for letting us know.  My thoughts are that a global action on the "New Sales Order" table would be able to iterate through all the rows and pass the location information over to the Line Item models.  But that's not really thoroughly tested...  

At the end of the day javascript will get you where you need to go.