Hi,
If an user creates a request from the portal, it automatically assigns the right organisation to the ticket. However, if an agent creates a ticket for the user, it doesn't automatically assign it. What is the best way to autofill the organizations field based on a user when an agent creates the ticket?
I can't seem to find the right automation rule for this, any suggestions for this issue?
Regards,
Melle van Keulen
It is best to use a post-function for this, set the organisation based on the reporter of the request instead of the creator.
How does that work? How does the reporter get associated to an organization. Which post Function are you using? Can you provide the details on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My apologies, I should've have made my answer clearer, especially since it requires Script runner,
I did it in the past using a scripted post-function with a similar code to the following :
def issueKey = issue.key
def organizations=get('/rest/servicedeskapi/organization').asObject(Map).body.values
def foundOrg;
for(def org in organizations){
String id=org.id
id=id.replaceAll("\"", "")
def users=get('/rest/servicedeskapi/organization/'+id+'/user').asObject(Map).body.values
for(def user in users){
String accID=user.accountId
if(accID==issue.fields.reporter.accountId ){
foundOrg=org
break
}
}
if(foundOrg!=null){
break
}
}
def orgid=foundOrg.id.replaceAll("\"", "") as Integer
def result = put("/rest/api/2/issue/${issueKey}").header('Content-Type', 'application/json')
.body([
fields: [
customfield_10002 : [orgid]
]
])
.asString()
customfield_10002 here being the Organizations field,
it's not the cleanest/clearest code but it does the job.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fantastic @said kouzibry, just what I was looking for. My case is a bit different as Customers sometimes choose to set the SM request as private "Share with No One". In this case the Organization custom field will be empty. I need to update a Tempo Account field based on the Organization content. I think I can manage to tweak the script, however I do need somehow to be able to support pagination to the Organizations call as we have more than 50 organizations. Do you know how to do that?
Much appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.