Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Changing the DOR for the Using API to generate Document of Record in AEM Forms

Avatar

Level 2

Hello,

 

I have implemented the sample and it works but I am not sure how to point this to my real DOR.

Any help would be great.

Noelle

9 Replies

Avatar

Employee

Can you please give some more details of the use case?

Avatar

Level 2

Hi,

 

The sample form has a button that uses the API to produce a "preview" of the DOR with the content of the adaptive form.  When I implemented the button on my form it still uses the DOR of the sample form.

Below is the function as you can see the DOR for the sample is hardcoded.

/**
* Get pdf
* @Return {OPTIONS} drop down options
*/
function getPdf()
{
console.log("in view pdf");
window.guideBridge.getDataXML(
{
success: function(result) {
var formData = new FormData();
formData.append("dataXml",result.data);
console.log("got data"+result.data);
var settings ={
"async": true,
"url": "/content/AemFormsSamples/getdor.html",
"method": "POST",
data:{'data':result.data},
}
$.ajax(settings).done(function(response)
{
console.log("got response");
window.open(JSON.parse(response).filePath,'_blank');
})

},
error:function(guideResultObject) {console.log("got error"); },
guideState : null,
boundData : true});

}

Avatar

Employee

Do you have a specific template that you want to merge the data with?

 

Avatar

Level 2

Yes, It is attached my form.  What I don't understand is why the sample hard codes the DOR to the sample and doesn't reference the form that it is being called from.

Avatar

Employee

I am in the process of updating the sample code to take in the xdp name in the request parameters

that way you can use the code to meet your use case

Avatar

Level 10

@NoelleSmith81 The dor in the sample takes the dor xdp node path from the jsp, you can update the ajax call and send a parameter in the function on the button click that has the form path. you can get this parameter in JSP just like data and that's it.

 

 

in form

const='some path'

 getPdf(const)

 

update ajax

 

function getPdf(formPath)
{

 

 

update the jsp as well.