ECM Forms - Java Script


Has anyone out there managed to or tried to do any java script inside ECM Forms? If so willing to share any hints or tips?

Here is a use case for something I am working on and I am not sure if it is possible, hence putting it out here for comment.

I want to launch an ECM form from another application and try and pass in some data and pre-populate. I have worked out that I can create a public link to the form and using a hash tag on the end of the URL I can add some extra Info and the form still loads. So what I am looking to do is to see if I could write some java script to read the extra data from the URL and use it to pre-populate some fields on the form.

I have no clue if this is even possible so if anyone has any insight, it would be gratefully received :smiley:

Many thanks,


Steve, with our experimentation into ECM forms and some help from Technical Support, we’ve pretty much concluded that there is little that can be done with a ‘form’. In essence, it’s a presentation layer template for a collection of fields. ECM treats the form like any other document - a collection of fields and the form’s image like the document image. It can be processed the same way via workflow’s and the like. We couldn’t see who to add code or any level of ‘processing’ to the form.

IN the end, we’re kind of disappointed with the whole thing. It’s pretty simplistic when it could be more. But of course it serves its purpose as intended.

We’re considering using MS PowerApps/Flow to do the forms work and processing, and then deliver the data/image back to ECM via the API or a File-Drop location.

We came to the same conclusion as @MikeGross. It is what it is and we couldn’t make it do more. Our ECM was cloud hosted by Epicor and our biggest issue was CORS. For security reasons (and rightly so), Epicor would not enable code to be run from a source not under their control.


Understandable, CORS can be a pain sometimes.

I think we are reaching the same conclusions with the forms. They are great in their place and we are making good use of them. But we are also creating a lot of bespoke interfaces now using REST and so we do have the knowledge and skills to go other ways too so I am evaluating this at the moment. I also have a lot of professional services budget available as they hugely over sold to us but the problem is professional services budget is only any good if there is resource to call on. And there isn’t any :face_with_hand_over_mouth:

If I come up with anything I will post on here.

We actually have managed to achieve this in the end. Having dropped the project for a while my colleague and I had another look and with his Java script skills we have now been able to build an ECM form link and read values from it and pass them into the form.

This is a real game changer for us as I thought we were dean in the water with this. So if anyone else want to do the same, here’s what we did:

In this scenario we are launching a form to collect data about a job from MES so we wanted to pass in the Job Number and employee ID to do this we added the following to the end of the form URL


Then in the Java Script

let a = top.location.href.split(“&JobNumber=”);
let b = a[1].split(“&EmpID=”);
let c = b[1].split(“&END”);

And then these values are read from the URL and put into the fields JobNum and EmpID


This is great news and really could extend the usage of forms for a number of folks.

Might you be able to share a bit more about where/how you edited the javascript on the form - sort of a tutorial for folks here so they can see if they want to try it?

Will this javascript code fail if the URL doesn’t contain the extra values?

EDIT - I had to go find where this was for myself, and it looks like this functionality appeared in a recent release - after we started with and then put aside the forms project.

We tried not passing values and passing the parameters with no value and it doesn’t error.

I still have a bit of an issue in that ECM Forms don’t have a validate or lost focus event or similar on fields to trigger a data look up. So In this case I have a DataLink that receives JobNum as a parameter and is set up as a drop down box. This then allows me to return multiple values to various fields.

Just edit the java script


Then insert the code:

thanks for the info. I’ll have to dig deep on this to see how it works with some datalink lookups and workflows.

I did see a difference - and maybe it’s version related. When I insert your code the lines show an error until I change it to this. We are v22.2.120 currently.