Page 1 of 1
Change to locks?
Posted: Wed Sep 13, 2023 2:54 am
by anthon
We have a process that creates a job in simPRO and then populates a number of fields, including notes, attachments, parts required, labour etc.. This process locks the job once created to allow the setup to be completed before a user can pick the job up and work with it.
In the last 24/48 hours, this lock has been preventing our integration user from updating the job it locked itself, meaning only the job creates with none of the details.
Has something changed in relation to job locking? I haven't seen anything in the recent API update notifications that mentions this.
Re: Change to locks?
Posted: Wed Sep 13, 2023 4:44 am
by Sindre
Hi anthon,
Could you please send me a private message with your build details and the endpoints used and requests sent that leads to the job unintentonally locking up and I will test to see if we can replicate it.
Regards
Re: Change to locks?
Posted: Tue Dec 17, 2024 4:46 am
by Nero
hi, I am having similar issue when trying to create a simpro job using these API calls:
a) create job
b) update job custom field 1
c) update job custom field 2
d) update job custom field 3
e) update job notes
f) add job->section
g) add job->section->costcenter (multiple iterations)
h) add job->section->costcenter->prebuild (multiple iterations)
Problem 1) If a front-end user opens the job before I have finished step (h) then that user locks the job and my next API update step fails
Problem 2) If I call API to lock the job after step a) -this does stop the front end user from locking the job, but the lock also prevents the API from doing further updates (err 422 - "This job is currently locked by <myAPIuserCredential> through an external application. Please try again later.") - meaning I would have to delete the lock before doing the next update step (making it pointless to add the lock in the first place)
Problem 3) (even if the API lock had worked) - The lock gets auto-removed on the next API update, meaning I'd need to repeatedly request a new lock after each API update (creating a gap where front-end user can lock job again)
I have tried to do steps a-h simultaneously via a 'Post Subresources' (
https://developer.simprogroup.com/apido ... bresources) API call, but that doesnt work with custom fields (error: /CustomFields This API Column does not allow POST requests)
Q1) how do I prevent the front end user from locking the job while I am still creating job via API.
Q2) what is the use case for the 'create job lock' API call? (
https://developer.simprogroup.com/apido ... g/Job-Lock) I cannot see how it can be used in my scenario, so when would it ever be used?
Q3) How are other developers solving this problem when creating jobs (with custom fields) via API
Thankyou
Re: Change to locks?
Posted: Fri Jan 03, 2025 3:48 am
by SimproAPITeam
Hi Nero,
This sounds like a potential bug,
Please see more information on why and how to report issues in our post here:
viewtopic.php?f=3&t=2675
Re: Change to locks?
Posted: Sat Jan 04, 2025 2:28 am
by Platenigh43
It sounds like a frustrating issue, especially since the locking mechanism worked as expected previously. Based on your description, it seems like the integration user’s permissions or the job locking behavior might have been unintentionally affected.
A few things you could check:
Recent Changes in simPRO Configuration
Have there been any updates or changes to the user roles, permissions, or automation rules in simPRO? Even a small tweak to the locking rules might impact how your integration behaves.
Integration User Permissions
Ensure the integration user still has full permissions to modify locked jobs, especially ones it creates. If there was an update to the API or user role configurations, this could have been impacted.
API Logs
Review the logs of your integration. Check if there are any error messages or codes returned when the integration user attempts to update the locked job. This can provide clues about what’s happening.
Support Channels
If you haven’t already, it might be worth reaching out to simPRO support to confirm if anything has changed on their side regarding job locking. Sometimes, undocumented behavior changes can occur with backend updates.
Hopefully, it’s something straightforward like a permissions tweak or an overlooked API flag. Let us know what you find!
Re: Change to locks?
Posted: Mon Jan 06, 2025 2:57 am
by Nero
<duplicate reply deleted>
Re: Change to locks?
Posted: Mon Jan 06, 2025 3:01 am
by Nero
thanks for the helpful suggestions, they lead me to an idea of what the issue could be:
In Simpro Premium, our "API Application" uses "Authentication Method"="API Key", as far as I can tell, this means there is nothing associating the "API Application" to a "user" and therefore there aren't any user permissions to tweak.
Maybe @SimproAPITeam can confirm whether the 'API Key' grant type can update a self-locked job (when essentially there is no real user for that lock - only a "pseudo user" - which I cant view or configure via front-end).
Also, I couldnt find where to view "API Logs" (I see "Webhook Logs" but no "API Logs") - the Job's "Log" shows nothing interesting.
The actual error returned by the API is 422 -(see 'problem 2' of my original forum post for the text).
I cant see any "API flags" or config beyond the 'API Application' page which is minimal.
I'm not sure where to view any automations either, but I will investigate that further.
if there's no confirmation here that "API Key" is the cause of my issue then I will go ahead and raise the suggested support request, will also try out different grant types for more clues.
thanks again.
Re: Change to locks?
Posted: Sun Jan 12, 2025 10:29 pm
by SimproAPITeam
Hi Nero,
Regardless of the grant type, the request should be treated the same.
If the problem persists, please raise it with the support and our team will investigate it.
Thanks.