Application Programming Interface forums

0 Prenumeranter

3 Ämnen

5013 Samtal

Area for questions and answers about SuperOffice API's.

All conversations (5013)

done
Answered
push_pin lock

Preventing a quote from being converted into an Order via a CRM Script

Hi, A customer has asked us to do some scripting, so that when a new company is added, it is added with a status of Unapproved (and possibly linked with SAINT show some kind of unapproved image on the company card).  When the rep has done all the due dilligence checks, and attaches all relevant documentation to the customer record supporting these checks, then have them click a menu item on the task menu to send an email to an "Approver" SuperOffice user to approve the company.  This email would have a hypelink to the company record, which the approver could open, and select another option on the task menu to approve or deny the company. All of the above I can do with CRM script.  But they want users whilst the company is in an unapproved state, to be able to raise quotes and opportunities, but not be able to select the "Place Order" button on the quote until the account has been approved. I have looked at the "Before saving quote" event with the test code below. EventData ev = getEventData(); ev.setBlockExecution(true); ev.setMessage("Test"); But this seems to only fire on the quote record when you click the "Close" button, not when you click the "Send" or "Place Order" buttons, which will also perform a record save, and even when running on the close button, does not run the setBlockExecution line of the code. I also thought that maybe I could set in the backend the status of the quote to require approval on save to get round the problem that way, but they still want the users to be able to send the quote and create new revisions of the quote, just not convert it into an order, which is not the way the built in quote approval system works. Is there any possible way around this, with the current scripting events available?  I know we could probably achieve this with a custom quote connector, but that does seem a bit of an overkill for what we need to do. Many thanks, Trevor
Trevor Sharp
2
1
18 h, 30 m sedan | 02:26 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Hi David, I thought that is what you might say, but thanks for confirming, I will not spend any more time on this (apart from following the wishes 😊). Thanks again, Trevor
by Trevor Sharp
14 h, 20 m sedan | 06:35 em
done
Answered
push_pin lock

Archiving an email in SuperOffice created by a CRM Script

Hi, I am sending an email from SuperOffice via a CRM Script (pretty basic code below, but in my full code I am also using reply templates, and the parser variables). //Send Email Email email; email.setValue("to", toEmailAddress); email.setValue("subject", subject); email.setValue("bodyHtml", bodyHtml); email.send(); I now want to archive that email in SuperOffice, so that it looks like a standard SuperOffice archived email, I.E. I can see values in the email to field, email subject, and email body. At this point, I cannot even seem to set the email body, with the code I have below not working (based on the AI results produced from SuperOffice Docs). NSDocumentAgent agent; NSDocumentEntity doc = agent.CreateDefaultDocumentEntity(); // set properties (name, contact, etc.) on doc //Set Document Template NSDocumentTemplate docTmpl; docTmpl.SetDocumentTemplateId(154); doc.SetDocumentTemplate(docTmpl); //Set Document Heading doc.SetHeader("Demo"); //Set Document Filename doc.SetName("POC " + getCurrentDateTime().toString("YY2MM2DD2HH24MI2SS2") + ".somail"); //Save Document doc = agent.SaveDocumentEntity(doc); NSStream stream; stream.SetStream(bodyHtml.toByteArray()); doc = agent.SetDocumentStream(doc, stream, true); The code does not error when I run it, but I do then get an error when trying to open the archived email that the CRMScript has created.  I haven't even got to the point of looking to set the email to address and subject. Is it possible to archive an email via CRMScript that was created using the Email agent? Many thanks, Trevor  
Trevor Sharp
3
2
19. okt. 2026 | 03:03 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Thanks Marcel, will keep this in mind.  For now the customer has decided, not to archive the email, but it is good to know that this is possible.
by Trevor Sharp
18 h, 51 m sedan | 02:04 em
done
Answered
push_pin lock

Authenticate API via SystemToken

Hi,   I have generated my SystemToken, is there Code sample or Docus, how could i authenticate my .net-SO Api via SystemToken for SystemUser? Thanks!
Jianchun You
1
1
14. okt. 2026 | 10:18 fm
Ämne:
Online development and web service API's

Senaste svar

Hi Margrethe, it works now. Thanks!
by Jianchun You
14. okt. 2026 | 05:41 em
done
Answered
push_pin lock

group by in SearchEngine

hi, we want to auto-fill in Tickets the extra-field "Cost Center" (in Germn "Kostenstelle") depending on its Ticket Person (in German "Ansprechpartner"), because each person in our Company belongs to a certain Cost Center: This Association is stored in our Active Directoary. But in crm scripts there is no Connection to our AD. My Idee will be, seach in all Tickets, what is the most Cost Center for that Person, this will be auto. filled in new Ticket. In SO Database, i reach that with SQL-Statement for my Person, important is here group by in SQL: Now i want to convert it in SearchEngine in crm scripts,   but it posts me Runtime Error  by Using grouping.   Thanks!
Jianchun You
3
5
30. sep. 2026 | 12:55 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Hi David, it works now in Trigger. Thanks a lot!
by Jianchun You
1. okt. 2026 | 08:56 fm
done
Answered
push_pin lock

Rename a document in sharepoint to a custom name

Hello everyone, if this is the wrong forum for my question, take my apologies and please guide me to the correct forum... I do want to rename a file (saved to sharepoint) based to the header name with CRMscript. But at least for our tenant, this does not work. The script basically does this:     String myNewHeader = myWantedHeader + docheader;     String myDocumentName = myWantedHeader + docheader + ".docx";     thing.SetHeader(myNewHeader);     thing.SetName(agent.RenameDocument(myDocID, myDocumentName));     agent.SaveDocumentEntity(thing); The Header is set right, but the document does not seem to be renamed in sharepoint. Also i do not get any error message - it just does not work. Am i doing something wrong here? Thanks and kind regards Joerg Hermanns  

JH

Jörg Hermanns
3
6
10. juli 2024 | 07:38 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Hi, It will never be overwritten, the API checks if the file already exists, and if it does, it will add a suffix to the filename. If we were to create a duplicate of the file with id 73, and rename it to NewName.docx , then the document name will become NewName (1).docx, because the original file already exists in the specific SharePoint folder.
by Matthijs Wagemakers
29. sep. 2026 | 11:30 fm
done
Answered
push_pin lock

Mailings Wizzard Workflow -> s_shipment . flags resets on active_pane change?

We are trying to reset the flags field in a way that allows us to ensure that bit 2 and either 4 or 10 are set. If this is not the case, we "repair" the value and send notification emails, one to the logged-in user and one to the administrator. The new flag values are successfully written to the database, and the emails are sent. However, when a user is working in the mailing wizard, which is usually the case, and proceeds to the next panel ( active_pane ), the flags are reset to the undesired state. Since there does not appear to be a suitable hook, such as a mailing pre-send hook, we do not see a way to implement this using hooks. A one-minute guard process is not a viable solution either. Even if we only apply the fix on screen 4 ( active_pane ), where the user can click Send Mailing , some users do not remain on that screen long enough for the guard to run. Is there a better way to achieve the desired behavior? Perhaps there is a way to disable these selections altogether, or remove some of the available options. We also tried renaming the options, but that did not have the desired effect. https://community.superoffice.com/en/technical/forums/product-forums/crm-web-application/how-to-translate-string-sr_admin_lists_useourcontact/ At this point, we seem to have reached the limits of the approaches available to us. But perhaps you'll find another way.

MK

Mathias Kosinski
3
2
23. sep. 2026 | 08:27 fm
Ämne:
Service and CRMScript Discussion

Senaste svar

You are already tagged as the "reported by", so you will get an email when the work item changes status. You can also monitor it here (and/or comment as needed): https://community.superoffice.com/en/product-releases/bugs-wishes/product-issue/?bid=121716&azure=1 Best regards.
by Tony Yates
24. sep. 2026 | 10:41 fm
done
Answered
push_pin lock

We have had a question from relating to API's around flows

Hi, I am not sure if this is possible, but a customer of ours wants to use flows to send emails to their customers with quotes in from an external system.  They want to create the flow, and create the email that will be sent to the customer, but using the designer tools that are built in to the Marketing emails. They then via the API, want to add a contact as a participant into the flow, which may well be possible, but then, and this is what I don't think will be possible, inticept the email that is being sent via the flow, and add the quote pdf document as an attachement to the email, before it is sent to the contact. I know there are other ways to do this without the flow, but they wanted to be able to use the marketing email designer to create the email template. Is this possible at all? Many thanks, Trevor
Trevor Sharp
1
0
24. aug. 2026 | 03:41 em
Ämne:
Online development and web service API's
done
Answered
push_pin lock

Missing operations in MergeMoveLog when merging companies

Dear All, I don't know if any of you have observed this - and possibly found a solution - but I have noticed that when I merge companies with identical persons, the MergeMoveLog only records the merge operation of the actual company and not any of the identical persons who was also merged in that operation. Here is an example of the log's output from the latest merge companies operation I performed: { "odata.metadata": "https://app.superoffice.com/Cust25645/api/v1/Archive/$metadata", "odata.nextLink": null, "value": [ { "PrimaryKey": "35527", "EntityName": "MergeMoveLog", "MergeMoveLog.operation": 1, "MergeMoveLog.sourceRecord": 24357, "MergeMoveLog.destinationRecord": 24356, "MergeMoveLog.options": "mergeIdenticalPersons=True&replaceEmptyFieldsOnDestination=False", "MergeMoveLog.updatedCount": 0, "MergeMoveLog.registered": "2026-08-11T19:19:33" } ] } No mention of the identical persons I had created for the test. When querying I am only filtering on the date/time of the event: Our webhook however, caught the very event, that I am missing in the MergeMoveLog: Is this working as intended? Is there any other way that I can get that information (other than looking at the info from the webhook)?   Best Regards, Henrik
Henrik Povlsen
1
0
12. aug. 2026 | 08:29 fm
Ämne:
Online development and web service API's
done
Answered
push_pin lock

Pretty format json?

Is it possible to pretty format a json string: Map m = Map (data); printLine(m.toJson()); Outputs: { "First": "Martin", "Last": "Andersen"} I would like to have it like this: {   "First": "Martin",   "Last": "Andersen" }   Regards Martin
Martin Andersen
4
6
10. juli 2026 | 10:54 fm
Ämne:
Service and CRMScript Discussion

Senaste svar

It is for output to an email send when an error occurs in a larger system, the email is send from a script and will contain a payload from an external system calling into a script. The email is not meant for users but for an administrator, and the prettyPrint will make it much easier to read.
by Martin Andersen
6. aug. 2026 | 07:33 fm
done
Answered
push_pin lock

Do Project Member Webhooks not work?

Hi, I am trying to create a webhook via a CRMScript based on changes made to project members. It looks like it should be possible, https://docs.superoffice.com/en/automation/webhook/reference/project-member-events.html , but nothing fires when I add/edit or delete a project member. Here is the code registering the webhook. #setLanguageLevel 4; String targetCrmScript = "ProjectMemberWebHook"; String[] events = String("projectmember.created,projectmember.changed,projectmember.deleted").split(","); NSWebhookAgent webhookAgent; NSWebhook webhook = webhookAgent.CreateDefaultWebhook(); //NSWebhook webhook = webhookAgent.GetWebhook(1); webhook.SetEvents(events); webhook.SetName("Project Members Web Hook Handler"); webhook.SetType("crmscript"); webhook.SetTargetUrl(targetCrmScript); webhook.SetErrorsEmail("trevor.sharp@synergytechnology.co.uk"); webhook.SetState(1); // Set it as active! webhook = webhookAgent.SaveWebhook(webhook); printLine("Webhook succeeded with ID: " + webhook.GetWebhookId().toString()); And here is the webhook. #setLanguageLevel 4; String variablesAvailable = ""; Map m = getVariables(); while (!m.eof()) { variablesAvailable = variablesAvailable + m.getKey().stripLeadingAndTrailing(" ") + " - " + m.getVal().stripLeadingAndTrailing(" ") + "<BR>"; //Move To Next Record m.next(); } log(variablesAvailable); It writes ok to the log when I enable the webhook, but nothing is added to the log when I make changes to the Project Member, and I cannot get any traces from this script. Also with the new screen for creating the webhooks via the GUI, this does not reference the Project Members table, which makes me wonder if it is not supported, but then why have a whole help page on project member events if it is not supported. Does anyone know whether the project members web hooks should fire or not, have I missed something in my code, or am I trying to achieve the impossible. Many thanks, Trevor
Trevor Sharp
2
2
4. aug. 2026 | 03:01 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Brilliant, thank you David.
by Trevor Sharp
5. aug. 2026 | 01:08 em