コミュニティ

Finding a Field in C# Script

I have added a Checkmark field in my Document Definition that I need to check based on the value in a Character String field.

I am trying to write a script in the Character String field's AutoCorrect Options to test the value to determine if the Checkmark field needs to be checked. I am having problems trying to find the Checkmark field to set it's value.

I have seen several examples on this forum that use Field("fieldname"),Value or Context.Field("fieldname").Value but when I try to use either in my script I get an error saying "The name 'Field' does not exist in the current context" or "The name 'Context' does not exist in the current context".

I can't find anything in the documentation that tells how to access the Field() method.

Am I missing a "using" statement or do I need to use something else to access the Field() method?

Thanks,
Tom

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

6件のコメント

  • Avatar
    Anastasiya Nechaeva
    Hi Tom,


    Method Field belongs to Context object. You can refer to it using the similar code:

    Context.Field(“fieldname”).Text


    0
  • Avatar
    Permanently deleted user
    Anastasiya,

    Where do I get the document variable?

    Thanks,
    Tom
    0
  • Avatar
    Anastasiya Nechaeva
    Tom,

    Could you please share your script?
    0
  • Avatar
    Alberto Torino
    Do you really need to perform the validation of your checkmark field as part of the autocorrect script of your character field?. I believe you only have Access to the field value during the autocorrect script execution. May be if you could move your code to the check mark field you can add the character field to the list of available fields for a rule and access the both values. Hope this helps . Regards.
    0
  • Avatar
    Permanently deleted user
    I solved my problem by creating a Rule and adding a script to determine if the checkmark field needs to be checked and using the Context.Field() to find it and set it.

    Thanks,
    Tom
    0
  • Avatar
    Permanently deleted user
    How to assign a value to a variable with IDocument type?

    Thanks
    0

サインインしてコメントを残してください。