How to remove a value from a field via business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 09:28 AM
I have 3 values ina field which are being populated by Business rule. namely, A, B and c.
Now my requirement is based ona status i want to remove a value A from the field by keeping the values B and c.
Can anyone please help me on this.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 10:12 AM
But i am already using BR to add the vlaues to the field, as i am doing a integration and 3rd party gys will be sending me those field values to a table and based on that tbale record i am populating them in the RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 01:45 PM
code will look like this provided you are trying to nullify or set the values.
if(ga=='Retired') {
current.host_name = ''; // whatever value you need to set here. example host_name = 'A';
current.ip_address= '';// whatever value you need to set
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 02:32 PM
I dont want to Nullify the value just want to wipe out one value which is in the value,
Ex: Value = asdfghjkm,bfgbjhnkm,mvgghjfgf.
Out of those three coma seperated values i want to remove just the First value before Coma.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 03:33 PM
Please check if something like this helps. sample script.
var final_value = [];
var value= ['asdfghjkm', 'bfgbjhnkm', 'mvgghjfgf']; // replace line of script with var value = current.field_name
var valsplit = value.split(',');
for(var i = 1; i < valsplit.length; i++){
final_value.push(valsplit[i]);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 04:39 PM
Inspired from Shishir's code, which contains an error : Shishir assumes the current field value is an array, where I assume it is a list :
//initialising an array for your data manipulations
var finalValue = [];
//given field value = 'asdfghjkm', 'bfgbjhnkm', 'mvgghjfgf' : assuming it is not an array, but a list
var myValue = current.<fieldname>;
var valSplit = myValue.split(',');
for (var i = 0; i < valSplit.length; i++){
if (<you want to run a test to know which value you want to keep or discard, then test selects values to keep, for using push method>){
finalValue.push(valSplit[i]);
}
}
//then you want to join to have again a list from your array
current.fieldname = finalValue.join();
current.update(); // you can omit this in a before business rule
This is if you want to remove A, B or C, based on a test.
If you just want to remove A, ie the first element of the array, use the shift() method instead of a loop :
//initialising an array for your data manipulations
var finalValue = [];
//given field value = 'asdfghjkm', 'bfgbjhnkm', 'mvgghjfgf' : assuming it is not an array, but a list
var myValue = current.<fieldname>;
var valSplit = myValue.split(',');
valSplit.shift();
//then you want to join to have again a list from your array
current.fieldname = finalValue.join();
current.update(); // you can omit this in a before business rule