This possible without javascript? row action to remove value in reference field


I have a workaround where I set the reference field that isn’t associated to anything anywhere called 
“No Upgrade”. Really don’t like this, but I need to continue with my work and get back to this later with a better solution.

K. Now I have another location where I need a solution to this. I need to remove the reference in the reference field.

If I need a function, can someone please point me in the right direction. The fields that need to be blanked out are “Quote_Line_Item__c” and “BLND_Upgrade_to__c”.

Pat, You are correct that this does not work with the action framework right now. It’s a bug. I think you are stuck using Javascript to update the row for now!

As it’s a bug, can someone please provide the javascript for this. Thanks.

Try something like this. BTW Pat can you explain how you have the rows in your tables turn yellowish when you hover over them? It looks really cool!

var params = arguments[0], $ = skuid.$;<br>var model = skuid.$M('YourModelName');<br>var row = model.getFirstRow();<br>model.updateRow(row,{<br>// I'm not 100% sure that null is correct it might have to be an empty string or something...<br>YourLookupField: null&nbsp;<br>});<br>model.save({callback:function(result){<br>if(result.totalsuccess){ // if the save went through<br>model.updateData(); // refresh the data on the page&nbsp;<br>}<br>}});

That yellow hover thing was mostly made by Scott. I helped a tincy bit. He gave me the CSS for it. Here you go.

table.nx-skootable-data tbody tr:nth-child(even):hover:not(.nx-item-has-drawer) td,table.nx-skootable-data tbody tr:nth-child(odd):hover:not(.nx-item-has-drawer) td { background-color: #FFB700; color:white; font-weight: bold;}<br>

It works!

Thanks, Moshe! I think doing null or ‘’ (the empty string) should work.

Moshe beat me to it…  

In your action sequence,  instead of an action of type “Update field on a row”  use the type “run Javascrip Snippet”  

In your resources your code can be as simple as this: 

$ = skuid.$;var model = skuid.model.getModel('YourModelName');<br>var row = model.getFirstRow();<br>model.updateRow(row, {ReferenceFieldName:''});


Moshe’s code goes ahead and performs the model save action,  which is nice - but can also be done by the Action Framework. 

If you depend specifically on the success of this field blanking before moving to the next step you should read about the Deferred Promise approach.