Highlighted
Micro Focus Expert
Micro Focus Expert
568 views

Copy Catalog Item name to title field of interactions

Jump to solution

Hi Experts,

We are having HP service manager 9.35.

Once a interaction is submitted , the title field is empty we want to copy the title field with the catalog item name selected:

For ex: Applications --> Web Applications --> ERP Application

 so we want to capture the last in hearichey i.e  ERP Application in title field of SD.(interaction)

I tried with placing the script in trigger records of incidents as:

var var1;
var var2;

var cartdetails1 = new SCFile("joinsvcDisplay");
var query1 = "id=\""+record.svcCatalogId+"\"";
var res1 = cartdetails1.doSelect(query1);
if (res1 == RC_SUCCESS)
{
var1 = cartdetails1.displayName;
var2 = cartdetails1.zvsrassgn;
print("the selected record found in joinsvcdisplay table");
print("the details are");
print("Catalog item: " +var2);
print("Interface info: " +cartdetails1.interface_info);
}

record.title = var1;
record.zvsrassgn1 = var2;
record.doSave();

print("the detail after update are");
print("Cart item: " +cartdetails2.zitem);

But it is not working & giving me the below result as :

Kindly suggest!!

Title field is still apprearing empty....

Thanks

Neo

 

 

 

 

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.
Super Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hello,

Could you please test using this JS in your trigger before update for the incidents table.

var svcCartList = new SCFile( "svcCart" );
var findsvcCart = svcCartList.doSelect( "sdID=\""+ record.incident_id + "\"" );
if ( findsvcCart == RC_SUCCESS )
{
var svcCartItemList = new SCFile( "svcCartItem" );
var findsvcCartItem = svcCartItemList.doSelect( "cartId=\""+ svcCartList.cartId + "\"" );
if ( findsvcCartItem == RC_SUCCESS )
{
var joinsvcDisplayList = new SCFile( "joinsvcDisplay" );
var findjoinsvcDisplay = joinsvcDisplayList.doSelect( "id=\""+ svcCartItemList.svcCatalogId + "\"" );
if ( findjoinsvcDisplay == RC_SUCCESS )
{
record.title=joinsvcDisplayList.name;
}
}
}

Best Regards.

LPP

Global Support Delivery Software Support Expert

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.

View solution in original post

14 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Where do you define cartdetails2? I only see cartdetails1 being defined....but then you use cartdetails2

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Apologies

It is not cartdetails 2 it is cartdetails1 only. Typo mistake!!. Actuall script is:

var var1;
var var2;

var cartdetails1 = new SCFile("joinsvcDisplay");
var query1 = "id=\""+record.svcCatalogId+"\"";
var res1 = cartdetails1.doSelect(query1);
if (res1 == RC_SUCCESS)
{
var1 = cartdetails1.displayName;
var2 = cartdetails1.zvsrassgn;
print("the selected record found in joinsvcdisplay table");
print("the details are");
print("Catalog item: " +var2);
print("Interface info: " +cartdetails1.interface_info);
}

record.title = var1;
record.zvsrassgn1 = var2;
record.doSave();

print("the detail after update are");
print("Cart item: " +cartdetails1.zitem)

 

 

 

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

One you find the record in joinsvcDisplay, you print var2 in your debug statements, but you never print var1. Do that just to see what it says. 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hi Tompowe,

I have tried printing the content of print("Catalog item is : " +var1);

The output is : catalog item is :

 

In my case I slected request password reset

It should work but not sure why it is not working,,If you have any other aletrnate method do share I will try & let you know

Thanks

Neo

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

You need to do something like:

print("Catalog Display Name: " +var1);

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hi Tompowe,

I did exactly like what you mentioned : print("Catalog item is : " +var1);

var 1 value is printed. -> Catalog item is :Request Password Reset

Any other sugegstions!!

Thanks

Neo

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Can you show up a screenshot of this trigger?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hi Tompowe,

Pls find below screenshot:

thanks

Neo

0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hi Neo,

 

there is no need of doing a ".doSave()" because you are actualy inside of the before update trigger. The Save will be done automatical.

insert your mapping just inside of the while condition and delete the unused code lines for "var var1; and "var var2" in your trigger.

record.title=cartdetails1.displayName;
record.zvsrassign1=cartdetails1.zvsrassign1;

 Greets

Matthias

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Copy Catalog Item name to title field of interactions

Jump to solution

Hi  mweisenburger,

Modified the script as per your suggestion:

But the result is still the same:

please suggest

Thanks 

Neo

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy Catalog Item name to title field of interactions

Jump to solution

At the beginning of your script, can you try printing any fields from "record"? I'm not convinced that "record" even exists...

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.