This advanced function updates the embedded image tags in an a Zendesk article to display the service now Attachments instead of the Zendesk Attachment. This will be required when migrating Zendesk Articles into Service now.
Parameters:
String: article html
String: Zendesk attachment id List
String: Zendesk atachment name list
String: Service Now attachment sys_id list
String: Service Now attachment name list
Notes on Use
- The article record must be strict html. any formatting applied during data extraction must be removed. Notably any \" escape sequences must be replaced with "
- The article record, including the attachments, must already have been created on the Service Now instance before this function is used to migrate the article body.
- The list parameters should be comma seperated strings (without whitespace before or after the comma) Values can optionally be enclosed in double quotes.
- The Zendesk attachment id List and Zendesk atachment name list identify the attachments on the Zendesk Article. Both lists MUST have the same number of entries and each attachment in the attachment id list must have an item in the attachment name list at the same position in the list.
- The Service Now attachment sys_id List and Service Nowatachment name list identify the attachments on the Service Now Article. Both lists MUST have the same number of entries and each attachment in the attachment sys_id list must have an item in the attachment name list at the same position in the list.
- The list parameters would normally be temporary variables, with the temporary variable value being populated with a source/target lookup mapping to obtain the attachment information (making use of the Concatenate CSV multi-match action to provide a list or results)
The function will search the HTML looking for image <IMG> tags. For each one found:
- Obtain the src and alt attribute values
- See if the alt value can be found in the Zendesk attachment name List
- If it cannot, get the attachment id from the src attribute value
- Find the position of the attachment id in the Zendesk attachment id List
- Use this position to obtain the attachment name
- Find the position of the same attachment name in the Service Now attachment name List
- Use this position to obtain the sys_id of the attachment
- Replace the src attribute value with the path to the Service Now attachment (\sys_attachment.do?sys_id=<sys id>)
If an attachment sys_id cannot be found for any reason, a warning will be raised for this record and the IMG tag will remain unchanged.
Comments
0 comments
Please sign in to leave a comment.