How to get a source filename and save it as a field value?

Question

How to save the filename of the imported file in the field? 

Answer

It is possible to get a source filename and write a value to a field in the Custom activity. For example:


Context.Transaction.Documents[0].GetField("New Field").Value = Context.Transaction.Documents[0].SourceFiles[0].FileName;

The result:

Have more questions? Submit a request

Comments

2 comments

  • Avatar

    Randy Woodward

    I created a new text field named "Orig_File". and then added a Custom activity with the following script:

    Context.Transaction.Documents[0].GetField("Orig_File").Value = Context.Transaction.Documents[0].SourceFiles[0].FileName;

    Running a "Test Skill" in Advanced Designer shows this error:
     JavaScript runtime error: Cannot read property '0' of undefined.
    0
  • Avatar

    Tatiana Dyu

    Hi Randy, it seems that you are using the Script activity in the Advanced Designer. The Custom activity that is mentioned in the article relates to the Process Skill: https://vantage-us.abbyy.com/help/English/SkillDesigner/?topic=procskill_activity_custom

    Hope that helps.

    0

Please sign in to leave a comment.