UiPath Documentation
activities
latest
false
Importante :
Este contenido se ha localizado parcialmente a partir de un sistema de traducción automática. La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.

Actividades de integraciones clásicas

Inicio rápido: objetos y archivos adjuntos

Información general

El propósito de esta guía es ayudarle a crear una muestra de trabajo que utilice las siguientes actividades de ServiceNow:

Esta muestra funcional le permite verificar rápidamente la conexión a su instancia de ServiceNow y familiarizarse con los tipos de datos de entrada / salida de la actividad.

Después de completar los pasos de esta guía, tendrá una secuencia de automatización que hará lo siguiente:

  1. Establece una conexión a tu instancia de ServiceNow (Ámbito de ServiceNow).

  2. Crea un nuevo incidente de ServiceNow (Insertar registro de ServiceNow).

  3. Carga un archivo en el nuevo incidente (Añadir archivo adjunto).

  4. Descarga el archivo cargado en una carpeta local (Descargar archivo adjunto).

  5. Elimina el archivo cargado (Eliminar archivo adjunto).

  6. Verifica que el archivo se eliminó al intentar recuperar el registro del archivo adjunto y mostrar el mensaje de error esperado (Obtener registro de ServiceNow, Si).

  7. Elimina el incidente creado (Eliminar registro de ServiceNow).

Requisitos previos

Antes de comenzar:

  1. Completa los pasos de configuración de ServiceNow.
  2. Un archivo local para adjuntar a un registro de ServiceNow.

Pasos

Construya su proyecto

  1. Agregar una actividad.

  2. Enter the AssetName for the credential asset you created (during the Setup) for your ServiceNow instance username and password (e.g., "ServiceNowSignin").

  3. Create and enter a SecureString variable for your Password value (e.g., password).

  4. Create and enter a String variable for your Username value (.e.g, username).

  5. Add a second Get Credential activity.

  6. Enter the AssetName for the credential asset you created (during the Setup) for your ServiceNow instance Client Id and Client Secret (e.g., "ServiceNowClients").

  7. Create and enter a SecureString variable for your Password value (e.g., clientSecret).

  8. Create and enter a String variable for your Username value (.e.g, clientId).

  9. Añade la actividad Ámbito de ServiceNow después de las dos actividades Obtener credencial .

  10. In the Client Secret property, enter the SecureString variable you created for your Client Secret in the steps above (e.g., clientSecret).

  11. In the Client Id property, enter the String variable you created for your Client Id (e.g., clientId).

  12. In the Password property, enter the SecureString variable you created for your password in the steps above (e.g., password).

  13. In the Username property, enter the String variable you created for your username (e.g., clientId).

  14. Create and enter a String variable for your EndpointURL (e.g., endpointURL)

  15. Añade la actividad Insertar registro de ServiceNow dentro de la actividad Ámbito de ServiceNow .

  16. Haz clic en el botón Configurar dentro de la actividad Insertar registro de ServiceNow (esto abre el Asistente de objetos.

  17. In Select Object drop-down list, select Incident.

  18. Create and enter a String variable for the sys_id Value (e.g., sysID)

  19. Using the Add Single Field textbox, enter short_description.

    • Enter a short_description Value (e.g., "UiPath-Attachment").
  20. Click Done.

  21. Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., insertRecordResponse).

  22. Añade una actividad después de la actividad Insertar registro de ServiceNow .

  23. Enter the following Text: "Record created: "+insertRecordResponse.Success.ToString+" | sys_id: "+sysID (where sysID is the variable created for the sys_id Value field above).

  24. Añade la actividad Añadir archivo adjunto después de la actividad Escribir línea .

  25. Click the Configure button inside the Add Attachment activity.

  26. In the Select Object drop-down list, select Incident.

  27. In the FileName property, enter the full path to your local file (e.g., "C:\UiPath_Projects\DemoFile.docx") or click the Choose File button in the activity.

  28. In the ObjectSysId property, enter the sys_id variable you created for the Insert Record activity (e.g., sysID)

  29. Create and enter a String variable for the AttachmentId property (e.g., attachmentId).

  30. Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., addAttachmentResponse).

  31. Añade una actividad después de la actividad Insertar registro de ServiceNow .

  32. Enter the following Text: "Attachment added: "+addAttachmentResponse.Success.ToString+ " | sys_id: "+attachmentId (where attachmentId is the variable created for the AttachmentId property above).

  33. Añade la actividad Descargar archivo adjunto después de la actividad Escribir línea .

  34. Enter the FilePath where you want to download the file (e.g., "C:\UiPath_Projects\Downloads").

  35. In the SysId property, enter the AttachmentId variable you created for the Add Attachment activity (e.g., attachmentId).

  36. Añade la actividad Eliminar archivo adjunto después de la actividad Descargar archivo adjunto .

  37. In the ObjectSysId property, enter the AttachmentId variable you created for the Add Attachment activity (e.g., attachmentId).

Pruebe su proyecto

  1. Añade la actividad Obtener registro de ServiceNow después de la actividad Eliminar archivo adjunto .

  2. Click the Configure button inside the Insert ServiceNow Record activity.

  3. In the Select Object drop-down list, select Attachment.

  4. In the sys_id Value field, enter the AttachmentId variable you created for the Add Attachment activity (e.g., attachmentId)

  5. Click Done.

  6. Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., getRecordResponse).

  7. Añade una actividad después de la actividad Obtener registro de ServiceNow .

  8. In the Condition property, enter getRecordResponse.Success=False And getRecordResponse.Message.Contains("No Record") to determine if the attachment record was successfully deleted by checking the error message (where getRecordResponse is the variable your created for the ServiceNowStatus property above).

  9. In the Then statement box, add a Write Line activity.

    1. In the Text property, enter "Test passed: "+getRecordResponse.Message.
    2. Añade Eliminar registro de ServiceNow después de la actividad Escribir línea .
    3. Click the Configure button inside the Add Attachment activity.
    4. In the Select Object drop-down list, select Incident.
    5. In the Id property, enter the sys_id variable you created for the Insert Record activity (e.g., sysID).
    6. Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., deleteRecordResponse).
  10. Add a Write Line activity after the Delete ServiceNow Record activity.

    1. En la propiedad Texto , introduce "Registro eliminado: "+deleteRecordResponse.Success.ToString.
  11. In the Else statement box, add a Write Line activity.

    1. In the Text property, enter "Test failed: "+getRecordResponse.Message.
  12. Click Run and verify the Output window includes the expected write line values.

¡Ya está!

Para obtener más información sobre las actividades de ServiceNow (incluidas las entradas/salidas de propiedades de ejemplo), consulta la página Actividades para obtener una lista completa de actividades y enlaces a las páginas de detalles de las actividades.

  • Información general
  • Requisitos previos
  • Pasos
  • Construya su proyecto
  • Pruebe su proyecto

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado