Multirow variable set data missing when submitted through Service Portal

johnsonjohn
Tera Contributor

Hello - we are using a multirow variable set in one of our catalog items (contains 6 variables).  When the catalog item is submitted through the Service Portal, a lot of the data that was entered in the MRVS is missing when viewed in the platform.  When the same catalog item is submitted through the platform with the same data in the MRVS, all data is retained.

I haven't seen anything in the community describing this issue, and the closest thing I found in HI is not exactly the same (https://hi.service-now.com/kb_view.do?sysparm_article=KB0713584).  This seems to be a Service Portal issue.  Has anyone experienced this or able to provide some insight?  Thanks in advance!

1 ACCEPTED SOLUTION

After you posted the code of OnChange script I could reproduce the problem and I can suggest a workaround.

The main problem in your code exist in the line

g_form.setValue('u_ukbilling_total_inc_vat', total, total);

where total variable is a Number. As the result the value of multirow variable set uk_billing_invoice_details_new will be JSON string like

[{
	"uk_billing_total_inc_tax": 1,
	"uk_billing_sales_order_number": "b",
	"uk_billing_net_amount": "1",
	"uk_billing_invoice_number": "a",
	"uk_billing_tax_rate": "3"
}]

where the value of u_ukbilling_total_inc_vat variable is a number instead of a string. It's unclear why exactly, but it produce some problem in later processing of the data.

To fix the problem you can use for example the following code

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}

	//Type appropriate comment here, and begin script below
	var netamount = g_form.getValue('net_amount');
	var vatrate = g_form.getValue('tax_rate');
	var vattotal = parseInt((vatrate/100) * netamount, 10);
	var total = parseInt(netamount, 10) + parseInt(vattotal, 10);

	g_form.setValue('total_inc_tax', String(total));
}

where one sets string value. After the changes the problem was fixed in my test environment.

View solution in original post

12 REPLIES 12

Hello Ankur, thanks for your response.  The link is helpful and offers some suggestions.  Unfortunately, I am still unable to resolve the issue.  I appreciate the feedback nonetheless.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

If submitting thru the Service Portal, are the variables actually not created or just not shown in the Platform UI thru the Variable Editor? Check the Multi Row Question Answer table [sc_multi_row_question_answer] to verify if the variables are actually created.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi Mark, thanks for your response.  I checked the table as you suggested, and sure enough I don't see the missing values -- so somehow they're getting lost when submitted through SP.  When submitted through the platform, there are no issues.  So not sure what to make of this.