APIs & Integrations

EWood-Malloy
Participant

Can't publish a quote using custom coded action in a workflow

SOLVE

Morning! 

 

We are currently scoping out the possibility of automating quote generation for some of our accounts. 

 

I have code that
1. creates a new quote in draft state and adds in - the title, status, expiration date, language, esign enabled, some sender info, comments and terms. 

2. associates the quote to a deal

3. associates the quote to a signing contact

4. associates the quote with a quote template (custom one)

5. creates a line item and associates that to the new quote and to the deal

 

However when we try to publish the quote it fails with a 400 error message. 

 

We've checked the scopes on the private API which all seem present and accounted for but it is still erroring. 

We've tested and manually clicking through the quote to the final page (just before published stage) and then running the code and it works! What am I missing that is in a manual click through (no changes made what soever on this click through) that is is not picking up in the code to publish? 

 

Any help greatly appreciated. 😄 

0 Upvotes
1 Accepted solution
SAlexander43
Solution
Participant

Can't publish a quote using custom coded action in a workflow

SOLVE

Hi @EWood-Malloy , does it help to make sure that there's an hs_domain and hs_slug added when you try to publish?

 

You can look up code snippets for generating a random slug if needed.

View solution in original post

0 Upvotes
4 Replies 4
SAlexander43
Solution
Participant

Can't publish a quote using custom coded action in a workflow

SOLVE

Hi @EWood-Malloy , does it help to make sure that there's an hs_domain and hs_slug added when you try to publish?

 

You can look up code snippets for generating a random slug if needed.

0 Upvotes
EWood-Malloy
Participant

Can't publish a quote using custom coded action in a workflow

SOLVE

It does help!!!! Thank you very much @SAlexander43!!!

Looks like the domain isn't set as default after i associate the quote template. Adding that in and the random slug has sorted it! 

0 Upvotes
kennedyp
Community Manager
Community Manager

Can't publish a quote using custom coded action in a workflow

SOLVE

Hey @EWood-Malloy-- thanks for the details and doing some preliminary troubleshooting. 

 

@zach_threadint has some suggestions in this thread that could be useful! 

 

Could you also share the full 400 error? Does it give us any additional context? 

 

Maybe some of our other Community members have some tips for troubleshooting. Hey @mangelet, @Gonzalo, @ChristinaKay anything you can add here? 

 

Best, 
Kennedy


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
EWood-Malloy
Participant

Can't publish a quote using custom coded action in a workflow

SOLVE

Hi @kennedyp 

Thank you for coming back to me and the link to the other thread. 

The error mesage isn't very helpful. It just says 

Request failed with status code 400

I've tried the 'hs_currency' and this doesn't seem to be the probelm either. We are default USD and the deal is USD i'm still getting the same error message as above. 

I've added in a delay before publishing incase associating the line item wasn't happening as quickly as I'd hoped. I also went through to the other thread linked in the thread you mentioned and can't see anything there that would be causing the error either. We are doing it as a patch request and not a post request and all associations are being made before the quote needs to be published. 

Each of the steps is a separate block of code in my workflow. Would that be casuing any issues? On checking the quote it does create it is all fine and seems to be setting things correctly to the same quote so it should have everything it needs to be published. 

I am setting a signing contact. Do I need to also set them as the main 'non signing' contact in the code too? From looking at the quote it seems to infer that if they are the signer they are also a contact as well however. 

I'm running out of ideas 🤣

0 Upvotes