^bump^
I think the new actions on your junction model could work.
Iām using an action to update a date/time field when another field is changed on the same mode.
Seth
I tend to agree with Seth. Ā This is not possible just using the action framework - in a table as you have.Ā
If you were able to get the process item in a model (by itself) Ā then you could add a new row to the junction object table and pass the default value for sequence to it. Ā I believe this would have to be a two step process. Ā 1 being select the process - and filter the process model down to just that item, Ā and 2 populate the row in the junction object table.Ā
I also donāt think you are going to be able to have this function well in the āedit existingā scenario without some javascript.Ā
I was suspecting this. Basically think that I need to setup a listening function. Not even sure thatās what it is called.
On change, take the id of the reference and update a model condition with it in order to get access the desired data. Then I can update the second field.
Itās the listening part that Iām new to. Once I have the Id, then Iām good to go.
We got a similar thing working from this postĀ - check out the first half of Benās answer. Admittedly I havenāt tried running this on a reference field, but what it basically does is:
When āthis_field__cā is updated, then get another value from the same row, and populate it into āsecond__field__cā
var params = argumentss0], <br>$ = skuid.$,<br>updates = params.updates,<br>defaultSequence; <br>//if the process reference field is updated by the user, <br>//then get the value of default sequence field for that row<br>//check that field is being pulled into the Process Model in your page <br>if ('Process__c' in updates) {<br> defaultSequence = params.row.defaultSequence__c;<br> }<br> if (defaultSequence) {<br> params.model.updateRow(params.row,'defaultSequence__c',defaultSequence); <br> }
See if you have any joy with that!
Ā
this also needs you to create an action on the model - when model is updated, then run the snippet.
Also, as it is a reference field, this line:
params.row.defaultSequence__c;
might need to be more like:
params.row.Process__r.defaultSequence__c;
Greg. You are the man! That was exactly what I was looking for. This is the code I ended up with.
var params = arguments[0], $ = skuid.$, updates = params.updates; // if the process reference field is updated by the user, // then get the value of default sequence field for that row // check that field is being pulled into the Process Model in your page if ('RECON__Process__c' in updates) { var processModel = skuid.$M('CurrentLibProcess'), proModCond = processModel.getConditionByName('ProId'), defaultSequence; // set and activate condition processModel.setCondition(proModCond,params.row.RECON__Process__c); processModel.activateCondition(proModCond); // query model and wait til done before getting row and updating row $.when(processModel.updateData()) .done(function(){ processRow = processModel.getFirstRow(); defaultSequence = processRow.RECON__Sequence__c; params.model.updateRow(params.row,'RECON__Sequence__c',defaultSequence); }) .fail(function(){ }); }<br>
Nice. looks like you took it to another level there setting the conditions and querying the junction object.
Yup. As far as I know I had to do that. Still new to Skuid (3 months) and Javascript (1 month)
Well doneā¦ quickly passing all of upā¦Ā
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.