- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 11:21 AM
Hi All,
I have transform map in which I have a script for Reference field.
If the user is X domain and Trying to Load the data for Y domain it should not accept. It should must accept the Data of X domain and transform the data to target Table.
I tried using the below code :
var DID = gs.getUser().getDomainID();
gs.log('Domain ID is ==',DID);
var Domain = current.sys_domain;
gs.log('Current Domain is',Domain):
The first log returning as Empty and the second log is not identify its saying that sys_domain is not defined or null.
Can someone please help me with this Transform map.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 12:15 PM
Problem is with your Log statements. You are passing in a second parader to the gs.log function by using comma, use a concatenation operator(+)
gs.log("message","source");
Change to this:
var DID = gs.getUser().getDomainID();
gs.log('Domain ID is =='+DID); // changed comma to plus
var Domain = current.sys_domain;// Current in Transform Map? Are you sure ?
gs.log('Current Domain is'+Domain); // changed comma to plus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 12:15 PM
Problem is with your Log statements. You are passing in a second parader to the gs.log function by using comma, use a concatenation operator(+)
gs.log("message","source");
Change to this:
var DID = gs.getUser().getDomainID();
gs.log('Domain ID is =='+DID); // changed comma to plus
var Domain = current.sys_domain;// Current in Transform Map? Are you sure ?
gs.log('Current Domain is'+Domain); // changed comma to plus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 12:26 PM
I am also thinking the same whether Current will work or not.
but still the Domain ID I am getting as Null
But If run the below code in Backgroungd Scripts its working and returning the Domain Sys ID
var DID = gs.getUser().getDomainID();
gs.log('Domain ID is =='+DID);
But in Transform Script its returning as Null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 12:54 PM
When the imports and transform maps run, they actually impersonate a service account like system. So thats why you may be getting a blank value for gs.getUser().getDomainID() at the time of the transform map.
When the background script runs, its actually executes under the user who is logged in so gs.getUser().getDomainID() works.
gs.getUser() is only for currently logged in user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2018 01:23 PM
How is the data getting into your import table? How does SN know whether you are loading data for X or Y domain?