MakeAndModelJS SncMakeAndModel update the query to use company sys_id rather than company name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 09:01 AM
Hi,
Is it possible to update the functions within the MakeAndModelJS script include to query the company record sys_id rather than name?
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 01:20 AM
Hi both,
I can see that you've both answered questions on similar topics before so wondering if you have any input/idea on the above? I'm looking to confirm how/if the functions can be updated to use the company record sys_id rather than the name.
This is one of the functions in question:
MakeAndModelJS.fromNames = function(make, model, modelType) {
var modelTable = SncMakeAndModel.determineModelTableName(modelType);
var makeAndModelJava = SncMakeAndModel.fromNames(make, model, modelTable);
var mm = new MakeAndModelJS(makeAndModelJava);
return mm;
};
Make in the above is the company name which is being passed to SncMakeAndModel.
Steven

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 04:45 AM - edited 09-30-2024 04:45 AM
I'd suggest looking into using the normalisation data service. It's the intended way to a canonicalise your company names and is the intended method. The MakeAndModelJS uses this same behaviour and is why it wants the display value of a company - it'll internally use the normalisation engine to identify the correct company record.
https://docs.servicenow.com/csh?topicname=c_NormalizationOverview.html&version=latest