How to work with custom mail template?

Hello experts!

 

We wrote a script, the result from this script, we want it to be displayed in the letter that is sent to the user by event.

 

I created a mail template, i write                  $SCRIPT(ССС_Test)$

The recipient receives                                   $SCRIPT(ССС_Test)$

 

And there must be a value, how to fix it?

Parents Reply Children
  • The script you are calling needs to have one parameter only and this parameter needs to be of type ISingleDBObject or IEntity.

    In addition, you need to add a BaseObjectTypeAttribute to the script containing the type of the base object. In your case Person.

    Sample:

    <BaseObjectTypeAttribute("Person")> _
    Public Function CCC_Test( ByVal myEntity As IEntity) As String
    	Return "My return string"
    End Function

  • Mail template:

    $SCRIPT(CCC_BS_POST_1Time)$

    Example script:

    <BaseObjectTypeAttribute("Person")> _
    Public Function CCC_BS_POST_1Time(ByVal myEntity As IEntity) As String
        Return "sdfsdfsdfsdfsdf"
            
    End Function

    Result:

  • What version are you using?

    Can you try to use ISingleDBObject instead?

    <BaseObjectTypeAttribute("Person")> _
    Public Function CCC_BS_POST_1Time(ByVal myEntity As ISingleDBObject) As String
        Return "sdfsdfsdfsdfsdf"
            
    End Function

  • My version: 8.1

    <BaseObjectTypeAttribute("Person")> _
    Public Function CCC_BS_POST_1Time(ByVal myEntity As ISingleDBObject) As String
        Return "sdfsdfsdfsdfsdf"
    End Function

    I did this, but the error repeats

  • Process: Old (default)  = ADS_ADSAccount_Insert

    Process: New (custom) = CCC_ ADS_ADSAccount_Insert

    My script = CCC_BS_POST_1TimeBkRu

            Maybe the problem is that I created a "New" process by making a copy with “Old” and adding my step there (in which this "My script" runs). I see now that in the JobQueueInfo is a "Old" naming of the process.
            How can I change the behavior so that the "New" process is used? I do not understand where to do this.

  • Is it correct that in your sample the script is called CCC_BS_POST_1Time but in your process you call my script  CCC_BS_POST_1TimeBkRu?

    In the old process, you need to set the process flag "Do not generate" if you want to disable the old process.

    Just for being complete, you have compiled the database including all scripts and processes?

  • «Не генерировать»

    Cool! Thx it's worked!

  • The screenshots show how I was able to display the output from my script in a letter (maybe this will help someone).

    1- parameters in proсess
    2- letter