Solved

Adding Additional Affected User using AssystNet in 11.4

  • 18 April 2024
  • 8 replies
  • 49 views

Badge +3

I know that there is a feature in Assyst 11.6 to add additional affected user but we are running 11.4.3 version which does not support this feature. We have a use case where end user will be creating a request in AssystNet and will input a additional affected user in a custom lookup field and we need to add that user as a additional affected user using custom script. Did anyone achieve this using custom script using restAPI or through ETM. Would appreciate help on this.

icon

Best answer by asutliff 19 April 2024, 09:30

View original

8 replies

Badge +5

Hi Danesho,
 

I believe this would be possible by using the Action Processor and the ETM tool.

 

You would need a SQL file to obtain the custom fields used within your offering within assystNET, for example:

sql([[SELECT wcpc.string_value "USER_EMAIL"
FROM jptsys_web_cust_prop AS wcp
INNER JOIN jptsys_web_cust_prop_cont AS wcpc
ON wcp.jptsys_web_cust_prop_id = wcpc.jptsys_web_cust_prop_id
WHERE wcp.jptsys_web_cust_prop_sc = 'USER EMAIL' AND wcpc.entity_id = ]] .. EVENT_ID)

You’ll also need to create a source file within your .conf file. You can do this by including the below:

    {
        name = [[ "Create Source File for additional affected users" ]],
        data_generation = [[ { "..\\sql\\Additional_Affected_User.sql" } ]],
        condition = [[ true ]],
        activities = {
                        {"log", 
                        [["Additional_Affected_User.sql SQL completed successfully"]]
                        },
                        

                { "script",
                    [[        
                                            
                            IMP_FILE_NAME = "F:\\Axios\\Test\\Automations\\RequestRemoteUpload\\AdditionalAffectedUser\\AdditionalAffectedUser_"..EVENT_ID..".csv"
                            LOGGER:info("The Impport file name is " .. IMP_FILE_NAME)
                            -- open the txt file for writing in windows binary format
                            f_handler,err = io.open(IMP_FILE_NAME,"wb")
                            -- open the file for output (writing)
                            io.output(f_handler)
                            -- do some error trapping
                            if not(f_handler) then 
                                LOGGER:error("io.open returned error: " .. err)
                                os.exit(2)
                                return
                            else
                                LOGGER:info("Opened " .. IMP_FILE_NAME.. " OK")
                            end
                            io.write(string.format("%s,%s,%s\n", "eventID", "ShortCode", "AdditionalUser)) -- Column headers
                            io.write(string.format("%s,%s,%s\n", EVENT_ID, AFF_USR_SC, USER_EMAIL)) -- Data row
                            io.close(f_handler)                        
                            
                            BAT_FILE = "F:\\Axios\\Test\\Automations\\RequestRemoteUpload\\AdditionalAffectedUser.bat"
                            HEADER = "cd F:\\Axios\\Test\\Automations\\RequestRemoteUpload\r\n"
                            HEADER = HEADER.."PowerShell -NoProfile -ExecutionPolicy Bypass -Command "
                            HEADER = HEADER.."\"F:\\Axios\\Test\\Automations\\RequestRemoteUpload\\importtool.ps1\" -url YOUR_ENVIRONMENT_URL/assystETM/REST/  -username assystETM_USERNAME "
                            HEADER = HEADER.."-password PASSWORD_HERE  "
                            HEADER = HEADER.."-channel \"ETM_CHANNEL_NAME\" -filename \"" ..IMP_FILE_NAME.."\""
                            HEADER = HEADER.."\r\n"
                            LOGGER:info(HEADER)
                            -- open the txt file for writing in windows binary format
                            f_handler,err = io.open(BAT_FILE,"wb")
                            -- open the file for output (writing)
                            io.output(f_handler)
                            -- do some error trapping
                            if not(f_handler) then 
                                LOGGER:error("io.open returned error: " .. err)
                                os.exit(2)
                                return
                            else
                                LOGGER:info("Opened " .. BAT_FILE.. " OK")
                            end
                            io.write(string.format("%s",HEADER))
                            io.close(f_handler)
                            os.execute(BAT_FILE)
                            
                        
                    ]]
                },
        },
        "continue",
    },

For your .bat file:

cd F:\Axios\Test\Automations\RequestRemoteUpload
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "F:\Axios\Test\Automations\RequestRemoteUpload\importtool.ps1" -url YOUR_ENVIRONMENT_URL/assystETM/REST/ -username ETM_USERNAME -password ETM_PASSWORD -channel "ETM_CHANNEL_NAME" -filename "F:\Axios\Test\Automations\AdditionalAffectedUser\AdditionalAffectedUser_5255103.csv"

You can then configure your ETM data mapper to put the value ‘inbound.AdditionalUser’ as a custom contact user.

I have not tested this method but feel that this would work - this does assume that you already have the ‘importtool.ps1’ PowerShell script within your environment.

Badge +3

Hi @asutliff thanks for the reply and detail explanation, my issue is not with getting the additional affected user inside ETM but the final update which will  update the event and add the ‘inbound.AdditionalUser’ in the additional affected user field of the event.

Below is a screenshot from the Datamapper which I configured to update event and billing_approvar is the variable that has the additional affected users object, but i am not able to assign this object to Additional Affected user Field as it says ‘Search not supported by assyst, an expression must be used’ to update the event which i am assuming that ETM does not support update of additional affected user field for an event.

 

Badge +5

Hi, @danesho - no problem at all. Apologies, I misunderstood your question!

Can you try the below instead of the ‘Additional Affected User’ field? I cannot see the extended details of your ‘billing_approver’ variable but you will need some way to extract some kind of value from the variable (Name, ID, Short Code, etc.)

It’s also worth running an import to see if it works as it appears when I debug, it doesn’t show a value but the additional user is added to the ticket as expected.

 

 

Badge +3

@asutliff I am not able to see the Custom Contact user field in Data Mapper probably you are using updated version. What is your ETM and Assyst Version, my one is ETM  1.7.1 and Assyst 11.4.3. I am trying to achieve this using 11.4.3 version and that is my main challenge :( 

Badge +5

@danesho - We are on ETM 1.5 & assyst 11.4.1, perhaps this was removed in one of your upgrades?

Is your assyst resource set to ‘Event’ at the top of the mapper?

Badge +3

 

Yes it is set to Event, but its strange that we dont have this feature and our version is upgraded then yours. Seems like i need to create a support request with IFS. 

 

 

Badge +5

Hi @danesho  - I have one more thing you could try.

When using the below in my environment, I can still assign an additional affected user within the ticket even though it suggests an expression must be used. 

In my case, I am getting the imported users managerId and then using that as the additional affected user but in your case, you need to try and extract the ID of the user entered in your custom field.

 

Badge +3

Thanks @asutliff finally I am able to resolve the issue using your solution and further tweaking it by creating object with current and new additional affected user and assigning it to Additional Affected User field. 

 

Reply