Import Set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 10:32 PM
Hello Experts,
I want to import the stock rule into the stock rule table. In my excel model, the name is Apple Macbook Pro 16'' MVVJ2HB/A
but in the product model table, there are multiple product models with the same name, that is Apple Macbook Pro 16'' MVVJ2HB/A but their specifications are different. my model specification should be 16-inch 32 GB.please guide me thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 02:00 AM
Hi @Mark Wood ,
You can a scripted field mapping to map the correct model.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 02:57 AM - edited 01-12-2024 03:12 AM
Hi @Mark Wood
Did your issue get solved?
C |
If the provided solution meets your needs, kindly consider marking it as helpful and accepting it as the solution. This helps others who may have similar questions. |
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 04:46 AM
Hello @Saurabh Gupta ,
its not yet resolved i have written field map scripting could you please guide me why the below script is not working.
answer = (function transformEntry(source) {
if(source.u_model=="Apple Macbook Pro 16'' MVVJ2HB/A")
{
var gr=new GlideRecord('cmdb_model');
gr.addEncodedQuery("display_nameSTARTSWITHApple Macbook Pro 16'' MVVJ2HB/A^short_descriptionLIKE32gb");
gr.query();
if(gr.next())
{
return gr.display_name; // return the value to be put into the target field
}
}
else{
return source.u_model;
}
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 05:00 AM
Hi @Mark Wood
You can write script as below-
answer = (function transformEntry(source) {
if(source.u_model=="Apple Macbook Pro 16'' MVVJ2HB/A")
{
var gr=new GlideRecord('cmdb_hardware_product_model');
gr.addEncodedQuery("name=MacBook Pro 15"^model_number=MD322LL/A");// You can change this query as per your need
gr.query();
if(gr.next())
{
return gr.getUniqueValue(); // return the value to be put into the target field
}
else
{
return "";
}
}
else
{
return "";
}
})(source);
How to get Query-
Thanks and Regards,
Saurabh Gupta