UiPath Documentation
activities
latest
false
Important :
Veuillez noter que ce contenu a été localisé en partie à l’aide de la traduction automatique. La localisation du contenu nouvellement publié peut prendre 1 à 2 semaines avant d’être disponible.

Activités Classic Integration

Dernière mise à jour 18 mai 2026

Démarrage rapide : Objets et pièces jointes

Vue d'ensemble (Overview)

L'objectif de ce guide est de vous aider à créer un exemple de travail qui utilise les activités ServiceNow suivantes :

Cet exemple de travail vous permet de vérifier rapidement la connexion à votre instance ServiceNow et de vous familiariser avec les types de données d'entrée/de sortie de l'activité.

Une fois les étapes de ce guide terminées, vous disposerez d'une séquence d'automatisation qui effectuera les opérations suivantes :

  1. Établit une connexion à votre instance de ServiceNow (Étendue ServiceNow).

  2. Crée un incident ServiceNow (Insert ServiceNow Record).

  3. Télécharge un fichier vers le nouvel incident (Ajouter une pièce jointe).

  4. Télécharge le fichier téléchargé dans un dossier local (Télécharger la pièce jointe).

  5. Supprime le fichier téléchargé (Supprimer la pièce jointe).

  6. Vérifie que le fichier a été supprimé en essayant de récupérer l'enregistrement de la pièce jointe et en affichant le message d'erreur attendu (Obtenir l'enregistrement ServiceNow, Si).

  7. Supprime l'incident créé (Supprimer l'enregistrement ServiceNow).

Prérequis

Avant de commencer :

  1. Suivez les étapes de Configuration de ServiceNow.
  2. Un fichier local à joindre à un enregistrement ServiceNow.

Étapes

Construisez votre projet

  1. Ajouter une activité.

  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. Ajoutez l'activité Étendue ServiceNow après les deux activités Obtenir les informations d'identification .

  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. Ajoutez l’activité Insérer un enregistrement ServiceNow dans l’activité Étendue ServiceNow .

  16. Cliquez sur le bouton Configurer dans l’activité Insérer l’enregistrement ServiceNow. Cela ouvre l’Assistant Objet.

  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. Ajoutez une activité après l’activité Insérer l'enregistrement 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. Ajoutez l’activité Ajouter une pièce jointe à l’activité Écrire une ligne .

  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. Ajoutez une activité après l’activité Insérer l'enregistrement 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. Ajoutez l’activité Télécharger la pièce jointe après l’activité Écrire une ligne .

  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. Ajoutez l’activité Supprimer la pièce jointe après l’activité Télécharger la pièce jointe .

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

Tester votre projet

  1. Ajoutez l’activité Obtenir l’enregistrement ServiceNow après l’activité Supprimer la pièce jointe .

  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. Ajoutez une activité après l’activité Obtenir l’enregistrement 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. Ajoutez l’ activité Supprimer l’enregistrement ServiceNow après l’activité Écrire une ligne .
    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. Dans la propriété Texte , saisissez « Enregistrement supprimé: "+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.

Vous avez terminé !

Pour en savoir plus sur les activités ServiceNow, consultez la page Activités pour obtenir une liste complète des activités et des liens vers les pages de détails de l'activité.

  • Vue d'ensemble (Overview)
  • Prérequis
  • Étapes
  • Construisez votre projet
  • Tester votre projet

Cette page vous a-t-elle été utile ?

Connecter

Besoin d'aide ? Assistance

Vous souhaitez apprendre ? UiPath Academy

Vous avez des questions ? UiPath Forum

Rester à jour