Get tenant from scripting

Get tenant from scripting

bryce_crawford
Advocate Advocate
1,018 Views
5 Replies
Message 1 of 6

Get tenant from scripting

bryce_crawford
Advocate
Advocate

Is there a way to check the tenant with scripting? I have some integrations that will run in our sandbox tenant if I refresh it with the production version and forget to turn them off. I would like to write some validations in to make sure that it won't run if the tenant is the sandbox so I, or someone else, doesn't need to manually turn them off every refresh.

Accepted solutions (1)
1,019 Views
5 Replies
Replies (5)
Message 2 of 6

PLM-Sylvain.Bailly
Collaborator
Collaborator

Hi,

 

In my case, I have created a library script where I have defined some parameters:

 

var tenant = "Production";
var tenantName = "https://mytenant.autodeskplm360.net"; 

 

I call this library script when I need to use one of its parameters. For example, I have an action script checking if it is our production or our sandbox and do somehting different depending the situation (update the Test or the Prod ERP server). I use the parameter "tenantName" to send hyperlink in the email created in different action scripts.

 

The only thing that you need to do is when you migrate your production data to your sandbox is to update this library script with the correct values.

Message 3 of 6

philipfrench
Collaborator
Collaborator
Accepted solution

No, I never found a way to identify automatically what tenant you script is running on.

 

Perhaps Autodesk could the tenant ID could be please injected into the scripting session, along with userID, dmsID, etc.

 

Using some global variables in a function, or even a Tenant Config workspace to hold tenant name, is the way to go, as per the other suggestion.

Message 4 of 6

PLM-Sylvain.Bailly
Collaborator
Collaborator

In 2018 I have created an utodesk idea on the forum to have this feature: https://forums.autodesk.com/t5/fusion-lifecycle-ideas/check-tenant-name-on-script/idi-p/7903952 

Perhaps you can vote for it 🙂

Message 5 of 6

bryce_crawford
Advocate
Advocate
Just gave it another vote. This seems like an extremely useful feature given how critical integrations are for Fusion with what it is designed to do. I personally don't like leaving anything to chance/user error if at all possible.
Message 6 of 6

john.denner
Advocate
Advocate

I've been quiet for a while but this is one that has bugged me since the beginning.
As more qualified colleagues have mentioned, I've not found a way to do this. Similar to what @PLM-Sylvain.Bailly  mentioned, I created a workspace and set fields(variables) specific to a tenant. Using this method I can have distinct settings such as testing URLs, rules (like don't send an email), assigned to a record in that workspace. However, the possibility of not switching to the correct tenant still exists. But via script you'd be able to query the workspace and see which tenant setting(s) are active and adjust variables without having to touch any scripts. Of course though, this is my implementation and may not be suitable for others. But it's served me well for years now.

~Denner

0 Likes