Adding a communication with a Table Level Script and retrieving an array from the same record for assigning to the comm_subject field

I am not that familiar with table level scripts and I was hoping I could get some direction on which way to tackle this.

The situation is, I am adding a postinsertrecord script to the Lead entity, where a communication is created for the assigned user for a new lead in the system.

There are checkboxes which are checked for each item of interest in the New Lead and these I intend to collect into an array displaying either a name value or the caption value. New checkboxes will be added in the future as needed for each item of interest.

My query is:

Can I collect the checkboxes and push them into an array object and assign all names to the lead communication field comm_subject through the table level script by accessing the array object?

Or, is this better in the custom content (or js script file) and then referenced in the table level script via a hidden field for assigning to the lead communication comm_subject field?

Or, do I need to create a case statement in the table level script to reference each checkbox?

Thanks.

Regards,

Penny Vaskess

  • 0

    OKay, That makes sense.

    Except.. if I only want the checkboxes with a name containing "interest" or the id containing "interest" and not the opt out or other checkboxes on the form, can I be more specific?

    Thank you Jeff.

  • 0

    Okay. That confirms I am on the right track. thanks Jeff.

    Best regards,

    Penny

  • 0

    Penny

    This sort of thing can be using in Server Side code to grab check boxes and add them to a string. It should give you an idea.

    var stringMessage ="";

    var myBlock = CRM.GetBlock("LeadCustomScreen");

    var myE = new Enumerator(myBlock);

    while (!myE.atEnd())

    {

    myEntryBlock = myBlock.GetEntry(myE.item());

    recordFieldInfo = CRM.FindRecord("custom_edits","colp_colname='"+myE.item()+"'");

    if (recordFieldInfo.colp_entrytype==45 && Values(myE.item()))

    {

    stringMessage += CRM.GetTrans("ColNames",myEntryBlock) +"="+Values(myE.item())+"
    ";

    }

    myE.moveNext();

    }

    //This will just add the string to the screen as an error message

    Valid = false;

    ErrorStr = stringMessage

  • 0

    Yes.

    The line

    recordFieldInfo.colp_entrytype==45 && Values(myE.item())

    is the one that determines that this is a check box and have been filled in.

    The name of the field is in myE.item() or the variable myEntryBlock. That can be check whether it contains 'interest' using a string comparison.