Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 03:40 AM
I have an integration what is raising a catalog item, and here I would need a business rule to count how many times do we have a specific word in the variables called "External Description".
I can fetch the value from that variable "
var text = scReqItem.variables.external_description;"
but how can I check how many times the word "
"CustomerLineNumber" appears in this text?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 04:04 AM
okay, figured it out.
var count=0;
var c=0;
var temp='';
var scReqItemTaskCount = new GlideRecord("sc_req_item");
scReqItemTaskCount.addEncodedQuery(some querry);
gs.print(scReqItem.sys_id);
scReqItemTaskCount.query();
while (scReqItemTaskCount.next()) {
temp=scReqItem.variables.external_description;
c = (temp.match(/CustomerLineNumber/g) || []).length;
count = count+c;
c=0;
}
gs.print(count)
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 04:04 AM
okay, figured it out.
var count=0;
var c=0;
var temp='';
var scReqItemTaskCount = new GlideRecord("sc_req_item");
scReqItemTaskCount.addEncodedQuery(some querry);
gs.print(scReqItem.sys_id);
scReqItemTaskCount.query();
while (scReqItemTaskCount.next()) {
temp=scReqItem.variables.external_description;
c = (temp.match(/CustomerLineNumber/g) || []).length;
count = count+c;
c=0;
}
gs.print(count)