Approval and record update Workflow

malu
Tera Contributor

Can someone help me an idea on how to trigger a record update in workflow?

I have a catalog with asset record fields, when this catalog item filled in and submitted approval workflow should trigger and after approved it should capture the changes from the catalog item fields and update the asset record?

Any suggestion on how can we achieve this?

1 ACCEPTED SOLUTION

I am not sure, whether there is an more easier way to know any of the "Properties" are updated or not, since you are comparing with another object. In fact, If there are no changes in fields, SNOW GlideRecord will not "Update" actually, though we call "update" function. Here is some sample code to do this.



In "Run script" component, you can write like below.



var updateRequired = false;


var variable1 = current.variable_pool.variable1;


var variable2 = current.variable_pool.variable2;


var assetid = current.variable_pool.assetid;


var grAsset = new GlideRecord('asset table');


if(grAsset.get(assetid))


{


  var actualdata1 = grAsset.field1;


  var actualdata2 = grAsset.field2;


  if(actualdata1 != variable1 || actualdata2 != variable2)


              updateRequired = true;


  if(updateRequired == true)


  {


          grAsset.field1 = variable1;


          grAsset.field2 = variable2;


          grAsset.update();


  }
}


View solution in original post

21 REPLIES 21

malu
Tera Contributor

Ahh..now i don't see the issue BUT select model is not appearing in variable editor in requested item it shows empty. Due to this i can't see the duplicate entries in maintain items.



In Variable editor i can't see the Model which i selected in catalog item.


Screen Shot 2016-07-11 at 5.23.57 PM.png


Issue which was seen before is, whenever i used option to edit a model i can that product in the maintain item lists.


Screen Shot 2016-07-11 at 5.27.56 PM.png


Hi Ravi,



I don't quite understand this issue. I can see that, when "Select model" is clicked, its showing list of all models in pop-up page.   Are you not able to see any records, when you click on "reference" icon? I guess, it might be with the user account you are using this to test. Check whether the user is admin or he has sufficient roles.



Thanks


Rami Reddy