cancel
Showing results for 
Search instead for 
Did you mean: 

How to get content of attachment type attribute on CPQ script?

sbslmhmt
Participant
438

Hello,

Is it possible to read content(base64 or binary) of an attachment type attribute on script? We would like to send attachment from CPQ to ERP but I count find to way to read attachment attribute's content.

Best regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Sergey_L
Participant

Mehmet,


The following script is used in conjunction with an API call. We utilize this by creating a URL which opens the file. I don't know much about APIs yet, but I would think you can use this concept to pull the file into your ERP. To see how this fits into the bigger picture, see my answer on your other question: https://answers.sap.com/questions/13571166/how-to-send-attachments-to-erp-from-cpq.html


if Param is not None: #check if Param is not null
	if Param.docID is not None: #Check if param contains object docID
		obj = SqlHelper.GetFirst('SELECT * FROM AttributeFileAttachment a WHERE a.guid=' + "'" + Param.docID + "'")
		contentType = obj.contentType
		Content = obj.Content
		fileName = obj.FileName 
ApiResponse = ApiResponseFactory.FileResponse(contentType, Content)

Hope this helps. If you figure it out, I hope you'll share your solution with us!