Unable to make it work... automatic date update after selecting or unselecting a boolen field

Unable to make it work... automatic date update after selecting or unselecting a boolen field

Hi,

I'm trying to make something really easy (I guess...) What I want to do is to set a boolean field to be selected if I need to trigger 2 events in an application: another field updated with the current date and an automatic email notification to be sent.

I created the following script, which is suposed to be run when I'm creating or updating my form, but for a reason that I can´t understand is only working after the first submision of my form (meaning only works while updating a form)


if(Estatus_de_emision == "Si")
{
input.Fecha_de_Solicitud = input.Modified_Time;
}
if(Estatus_de_emision == "No")
{
input.Fecha_de_Solicitud = null;
}