Set and Extend Package Expiration
Thursday, June 9, 2022 at 04:43pmHi Duo,
Do you have an example of how we can use the APEX SDK to set the expiry date?
Also, looking for a method to extend the time for an expired package?
Thanks!
Peter
Hi Duo,
Do you have an example of how we can use the APEX SDK to set the expiry date?
Also, looking for a method to extend the time for an expired package?
Thanks!
Peter
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 08:27amHi Peter,
In order to specify expiry date, you'd set the "due" field of the Package_x:
Package_x pkg = new Package_x();
pkg.name = 'Example Package Using APEX SDK1 - ' + Datetime.now().format();
pkg.due = Datetime.newInstance(2022, 7, 1, 12, 30, 2)
......
String packageId = sdk.createPackage(pkg);
If to extend an expired transaction, it normally requires to reset the due date and resend the transaction like below:
Package_x pkg = sdk.getPackage(packageId);
pkg.status = PackageStatus.DRAFT;
pkg.due = Datetime.newInstance(2022, 7, 1, 12, 30, 2)
sdk.updatePackage(pkg , packageId);
pkg.status = PackageStatus.SENT;
sdk.updatePackage(pkg , packageId);
Let me know if these codes work for you.
Duo
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 08:49amPerfect. After the package expires, does the token in the original URL also expire thereby requiring us to generate a new token and send them a new URL? Or can they still use the old URL?
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 08:53amDo you mean the signing URL(authenticated with "?loginToken=")? From what I understood, this token will only be changed when a signer profile get changed, e.g. first/last name, email updated (but I am not sure on this point). But it will be safer to always regenerate a new signing URL when you extend the expiry date.
Duo
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 09:23amVery helpful.
One more related question about expiration. I noticed on our OSS portal settings says the maximum number of expiration days is 3. Does that govern what we can do with the above? Or does the per package due date setting override?
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 09:28amHi Peter,
The due date is limited by this package setting:
settings > ceremony > maximumRemainingDays : 210
However I am still wondering why it said 3 days for your account. If it's a sandbox account, can you share the account email to [email protected] so that I can do a quick check for your account settings?
Duo
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 09:38amSandbox shows 0 but our production account shows 3. Is this a hard limit for all packages?
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 09:43amI see. The settings from the screenshot is at the account level, but you can still override it at the package level at:
settings > ceremony > maximumRemainingDays : 210
However it's not part of the Apex SDK modelling, if you want to apply this setting, we may need to modify and extend the Apex class a bit.
Duo
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 09:48amOk, I just didn't want to get to production and it would fail because the account level limit rules over all.
Reply to: Set and Extend Package Expiration
Friday, June 10, 2022 at 10:50amHi Peter,
Sorry about the information above about "it's possible to override the maximum expiry date at package level". After some further tests, I found even if the "maximumRemainingDays" has been extended per transaction, both the API and UI still didn't take the value, so kind of the account level limit rules over all.
Given this background, is it possible for your production account to remove or increase the maximum expiry limitation?
On top of it, because your production account has this time-based expiry enabled, depending on whether your APEX code want to leverage the feature, you may need to set "due" field and disable the feature by "defaultTimeBasedExpiry": false (this requires to extend the APEX class) to have the behavior falls back to your sandbox experience.
Duo