Expand my Community achievements bar.

SOLVED

Submit function - How to Pick up supervisor's email address when clicking submit.

Avatar

Level 1

Hi guys,

I currently work on the IT Service Desk at UWS and would like your assistance with modifying some of our existing IT Access Forms.

Currently we have a submit function on our forms that when pressed will check that some mandatory fields are completed and sends an email into our ticketing system (just a mailto: itservicedesk@uws.edu.au)


The problem we are facing is requests are coming to us without approval so we are having to contact supervisors and check if the forms submitted by their staff are approved; very time consuming

What I was thinking is:

When user clicks the Submit button that the form picks up the email address entered into "Email Address" under Supervisor Details.

The form then emails the form to the supervisor with text that reads:

Dear Supervisor,

Could you please advise if you approve of the IT Access Form (attached). If you approve please Forward this email to itservicedesk@uws.edu.au (wording doesn't matter I can play around with it, moreso the coding behind the button)

I was unable to figure out how to attach our form in it's current state. If you could let me know how to do this I will attach it (can only find attach Image or Video)


Can you please investigate if this is possible for me? I have little to no knowledge of Java code or whatever it is that these things run on.

Regards,

Rob

1 Accepted Solution

Avatar

Correct answer by
Level 1

r.pizzin@uws.edu.au

Thanks Bibhu,

I appreciate your efforts!

View solution in original post

9 Replies

Avatar

Level 9

Hi Rob,

You can try the following.

var mail;

var add = address.rawValue; // The mail address you want to send

var subject = sub.rawValue;  // The subject you want to give.

mail = "mailto:" + add+ "?subject=" + subject ;

event.target.submitForm({

cURL : mail,

bEmpty : true,

cSubmitAs : "PDF",

cCharset : "utf-8"});

I have not tried how to add body here. But one of Stefan Cameron's link might help you. http://forms.stefcameron.com/2008/08/28/submitting-form-data-by-email/

Thanks,

Bibhu.

Avatar

Level 1

Hi Bibhu,


Thanks for replying.

What I am looking for isn't one specific email address everytime.

That is how we have it currently set up.

What I need is the form to pick up whichever email address the user enters on to the form in the Supervisor Email field. As you can imagine there are hundreds of different supervisors around this place, we'd like the form to send to the supervisor first to approve. The supervisor can then forward it to us for actioning manually themselves.

Is this possible?

PS: If someone can tell me how to attach a PDF into this forum then I can send you the form.

Alternatively, it is available on this website: http://www.uws.edu.au/information_technology_services/its/servicedesk/it_forms#user

The form is called IT Access Form

Avatar

Level 9

Hi Rob,

What I explained above is as per your requirement.

var add = address.rawValue; // The mail address you want to send -> This address value can be replaced with the Supervisor's Email adrees rawValue. i.e var add = SuperVisorEmailAdrress.rawValue. So it will take that dynamic value given by the user in the supervisor's email address field. So it's not hardcoded.

You can not attach PDFs directly due to some security restrictions. How ever you can upload that form in Acrobat.com and give the link here.

Thanks,

Bibhu.

Avatar

Level 1

Hey Bibhu,


Thanks for much for your help so far. You must please forgive my ignorance but I tried to copy your script in and made the changes as shown in screenshots.

Keep getting Syntax errors, not sure what could be the problem.

var mail;

var add = SupervisorEmailAddress.rawValue;

var subject = sub.rawValue; 

mail = "mailto:" + add+ "?subject=" + subject ;

event.target.submitForm({

cURL : mail,

bEmpty : true,

cSubmitAs : "PDF",

cCharset : "utf-8"});

Form Script error.jpgForm.jpg

Avatar

Level 10

Hi,

try this script:

var var0 = xfa.resolveNode("Form1.SupervisorEmailAddress").rawValue;

event.target.mailDoc({

          bUI: true,

          cTo: var0,

          cCc: '',

          cBcc: '',

          cSubject: 'My form',

          cMsg: 'Dear ...,\n\nhere is the final form data. \n\nKind regards\n...'

});

Avatar

Level 1

Hi radzmar,

Syntax errors again

Any ideas?

Note: I tried creating a new button as well, in case the existing one was the problem

FormScrip2.jpg

Avatar

Level 10

You have to select JavaScript as language, you currently have selected FormCalc.

Btw. you have to correct the SOM expression for the supervisor field from "Form1.SupervisorEmailAddress" into the one which matches your form.

I didn't know the correct one.

If you have Designer ES2 or above you can use my macro to create such email scripts easily.

http://thelivecycle.blogspot.de/2012/05/mailto-maker-marco-v1.html

Avatar

Level 9

Rob,

Give me your email address. I will send you the completed form.

Thanks,

Bibhu.

Avatar

Correct answer by
Level 1

r.pizzin@uws.edu.au

Thanks Bibhu,

I appreciate your efforts!