Generating Documents for Proposal with Large Number of Line Items
You can use this API to generate documents for proposals with a large number of line items, asynchronously for the given parameters.
API |
Signature |
---|---|
submitGenerateLargeDoc |
webService static Id submitGenerateLargeDoc(Id templateId, Id proposalId, String pLevel, String docFormat, Boolean isDraft, String sessionId, String serverUrl) |
Request Parameter |
|||
---|---|---|---|
Name |
Type |
Required? |
Description |
templateId | ID |
Yes |
The ID of the template you want to use for the proposal. |
proposalId | ID |
Yes |
The ID of the proposal for which you want to generate the document. |
pLevel | String |
Yes |
The protection level you want to apply on the document |
docFormat | String |
Yes |
The format in which you want to generate the document. The valid values for this parameter are listed below:
|
isDraft | Boolean |
Yes |
Indicate whether the generated document is a draft or a final document. |
sessionId | String |
Yes |
The session ID you want to use for the callback. |
serverUrl | String |
Yes |
The server URL you want to use for the callback. |
Response Parameter |
||
---|---|---|
Field |
Type |
Description |
asynccallRequestId | ID |
The ID of the asynchronous merge call SObject. |
Code Sample
/**
* The below method demonstrates how to create draft or final proposal document asynchronously by passing the proposal ID(auto generated ID as record name),
* template name, protection level, document format and isDraft indicator.
* Possible protection levels are:
* - Full access,
* - Insert comments and tracked changes only,
* - Insert comments only,
* - Fill in form fields only and
* - Read only
*/
public Id submitGenerateLargeDoc (String ProposalID, String templateName, String protectionLevel, String docFormat, Boolean isDraft){
Id asynccallRequestId;
Id proposalSOId = [SELECT ID FROM Apttus_Proposal__Proposal__c WHERE Name = :ProposalID LIMIT 1].Id;
Id templateSOId = [SELECT Id, Name
FROM Apttus__APTS_Template__c
WHERE Name = :templateName AND
Apttus__IsActive__c = TRUE
LIMIT 1].Id;
if (proposalSOId != null && templateSOId != null)
{
String serverUrl;
Apttus_Proposal__ProposalSystemProperties__c prop = Apttus_Proposal__ProposalSystemProperties__c.getInstance('System Properties');
if (prop.Apttus_Proposal__EnableFile__c )
{
serverUrl = URL.getSalesforceBaseUrl().toExternalForm()
+ '/services/Soap/u/50.0/' + UserInfo.getOrganizationId();
}
else
{
serverUrl = URL.getSalesforceBaseUrl().toExternalForm()
+ '/services/Soap/u/50.0/' + UserInfo.getOrganizationId();
}
asynccallRequestId = Apttus_Proposal.MergeWebService.submitGenerateLargeDoc(templateSOId, proposalSOId, protectionLevel, docFormat, isDraft, userInfo.getSessionId(), serverUrl);
}
return asynccallRequestId;
}