Jump to content
  • 0

Automated emails when specific data field is updated


logistics

Question

Hello,

I have a datapage set to send an email to the user when their record is updated.

However, the email is sent regardless of which field is updated, and regardless of how many times it is updated.

Is there a way to either:

  • Send the email only when a SPECIFIC field is updated on the profile? If so, how? (preferred option)
  • Only allow the email to be sent once? If so how?

 

Many thanks in advance for your help.

Julien

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
On 5/15/2017 at 3:57 AM, logistics said:

Hello,

I have a datapage set to send an email to the user when their record is updated.

However, the email is sent regardless of which field is updated, and regardless of how many times it is updated.

Is there a way to either:

  • Send the email only when a SPECIFIC field is updated on the profile? If so, how? (preferred option)
  • Only allow the email to be sent once? If so how?

 

Many thanks in advance for your help.

Julien

Hi Julien,

Yes, it's possible. You may trigger changing a field and when field is changed, insert email address into virtual field.  Then using virtual field in Email field for your acknowledgement email. Since I don't know type of your datapage, I created code for details datapage.

Insert script in the footer of your datapage:

<SCRIPT LANGUAGE="JavaScript">

function insert()
{

var x= document.getElementById("EditRecordEmail").value;

document.getElementById("cbParamVirtual1").value = x;

}

document.getElementById("EditRecordField1").onchange=insert;
</SCRIPT>

Insert your fieldname which you would like to trigger instead of Field1

Also I assume that you have email field on your datapage, so you need to insert your field name instead on Email in my code.

This way an email will be sent only if you changed value in specified field

Hope that helps

Link to comment
Share on other sites

  • 0
On 5/18/2017 at 3:10 PM, Mathilda said:

<SCRIPT LANGUAGE="JavaScript"> function insert() { var x= document.getElementById("EditRecordEmail").value; document.getElementById("cbParamVirtual1").value = x; } document.getElementById("EditRecordField1").onchange=insert; </SCRIPT>

Hi Mathilda,

 

I followed your instructions, but sadly I cannot get it to work.

I can get this error message in the debugger:

Unable to set property 'onchange' of undefined or null reference

 

My virtual field is called Virtual1, my email field is called Email_address and the trigger field is called Approved_by_CFA.

 

I inserted this scrip in the footer of the details page, but nothing happens if I update the 'Approved_by_CFA' field:

<SCRIPT LANGUAGE="JavaScript">

function insert()
{

var x= document.getElementById("EditRecordEmail_address").value;

document.getElementById("cbParamVirtual1").value = x;

}

document.getElementById("EditRecordApproved_by_CFA").onchange=insert;
</SCRIPT>

 

Thanks again for your help.

Julien

Link to comment
Share on other sites

  • 0
19 hours ago, logistics said:

Unable to set property 'onchange' of undefined or null reference

 

Hi Mathilda, I have managed to sort my issue out! I was using a radio choice field, hence why it wasn't working as my reference was not correct.

It's now fully working. Thanks for your help with this!

Julien

Link to comment
Share on other sites

  • 0

I am having trouble with this format.  I have the virtual field (to load email) on details page and the following script on the footer, but cannot get things to work.    I am not sure if the virtual field should be text and if there should be anything else marked for the external associations and defaults.  Could you provide any assistance from what you have done?

 

<SCRIPT LANGUAGE="JavaScript">

function insert()
{

var x= document.getElementById("EditRecord[@field:PBAEmployeeTable_EmployeeEmail]").value;

document.getElementById("cbParamVirtual1").value = x;

}

document.getElementById("EditRecord[@field:PBAEmployeeTable_YearLastNotified]").onchange=insert;
</SCRIPT>

Link to comment
Share on other sites

  • 0

Hi PDSRQ,

You do not use correct syntax to reference Datapage fields.

I believe that following Javascript will do the trick: 

<SCRIPT LANGUAGE="JavaScript">

function insert()
{

var x= document.getElementById("EditRecordPBAEmployeeTable_EmployeeEmail").value;
document.getElementById("cbParamVirtual1").value = x;

}
document.getElementById("EditRecordEmployeeTable_YearLastNotified").onchange=insert;
</SCRIPT>

Hope this helps.

Link to comment
Share on other sites

  • 0
On 12/8/2017 at 8:03 PM, PDSRQ said:

Still nothing.  I have this on the details page.  Is there a setting I should use on the virtual field?  Right now it is text field, but I don't have any of the advanced tab filled out, should there be something there on load?

Hi PDSRQ,

Please note that all fields used in Javascript should be editable hence you can use "Text field" form element.

You will not be able to use field value if you have used Display only/Hidden etc. form elements.

 

Regards,

Vitalikssssss

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...