The CreatorCon Call for Content is officially open! Get started here.

Checking for mrvs in a business rule

debrasimpson
Tera Contributor

In a business rule how can I test for the presence of a mrvs in a record created from a record producer. I can check if there are variables using if (current.u_variables_present == true) but it's not including the mrvs. Is there an equivalent statement for mrvs?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@debrasimpson 

Is there any field which you are populating in the target table to identify record created from which record producer?

If yes then you can get that record producer sysId and query "io_set_item" with that record producer with type as this

var recordProducerSysId = current.u_record_producer;

var query = 'variable_set.type=one_to_many^sc_cat_item=' + recordProducerSysId;

var gr = new GlideRecord("io_set_item");
gr.addEncodedQuery(query);
gr.query();
if (gr.next()) {
	// this record producer has MRVS in it
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Mohith Devatte
Tera Sage
Tera Sage

Hello @debrasimpson ,

you need to check like this

current.variables.your_mvrs_backend_name;

PLEASE MARK MY ANSWER CORRECT IF IT HELPS  YOU

 

Yousaf
Giga Sage

Hi,

Please refer to this link 

Getting Values from Multi Row Variable Set Record Producer

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***

debrasimpson
Tera Contributor

Thanks for your suggestions, but this is a business rule that handles records from multiple record producers. There is no set name of the mrvs. I'm trying to see if an mrvs is present at all and to copy its values to a text field in another record.

Ankur Bawiskar
Tera Patron
Tera Patron

@debrasimpson 

Is there any field which you are populating in the target table to identify record created from which record producer?

If yes then you can get that record producer sysId and query "io_set_item" with that record producer with type as this

var recordProducerSysId = current.u_record_producer;

var query = 'variable_set.type=one_to_many^sc_cat_item=' + recordProducerSysId;

var gr = new GlideRecord("io_set_item");
gr.addEncodedQuery(query);
gr.query();
if (gr.next()) {
	// this record producer has MRVS in it
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader