How to access getNextObjNumberPadded() in a client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2023 06:25 AM
I am going nuts here.
Could be I miss some basic stuff. Please try to help
Issue:
I want to create multiple records at once. Works using Import XML. I can preset all values the way I want them.
What does not work is: creating the number for those records.
I could use a onLoad client script which checks: number set: good, number not set: create one.
So I searched a lot and came accross:
getNextObjNumberPadded()
global.getNextObjNumberPadded()
new global.NumberManager().getNextObjNumberPadded()
new global.NumerManager('table_name').getNextObjNumberPadded()
new global.NumberManagerGlobal('table_name').getNextObjNumberPadded()
Problem is: none of these work. I can't seem to get hold of global.
Not even glide.script.block.client.globals = false will help
what I want to know:
can I use: getNextObjNumberPadded()? If not, can I use a catalog script (I understand this is more backend?) to achieve a similar effect (generating of missing numbers)?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2023 06:45 AM
Hi,
My apologies, your post is a bit confusing. Perhaps you can step back and tell us how you're bringing in these new records. You mentioned "works using Import XML", but then later in your post you talk about a possible "catalog script".
Can you give a breakdown of what you're trying to do here so that we may be able to understand and possibly suggest another way (if applicable).
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2023 06:51 AM
I need to create in certain circumstances, for different (up to 30) accounts, the same issue. XML Import will let me do this. What XML import does not do is: numbering these issues.
I now need a way to add the missing number once an issue is opened. Client Script onLoad seemed suitable. Yet I can't access that function .getNextObjNumberPadded()
As mentioned I tried everything. Could be, could not find documentation, this function is only available back-end.
If this is the case, only available back-end, then I would need to know how. Business rules, I think, are only applied on Insert/submit, not on Import XML. Catalog Script I have no clue how to get that working, as again: I lack proper documenation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2023 04:14 AM
I have managed to use a business rule (when = display)
Don't know why that didn't work before.
works like a charm now
thanks for your help anyway
code in business rule:
(function executeRule(current, previous /*null when async*/ ) {
if(current.number == '') {
current.number = new NumberManager(current.sys_meta.name).getNextObjNumberPadded();
current.setWorkflow(false); //Do not run business rules
current.autoSysFields(false); //Do not update system fields
current.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2023 10:05 AM
Me gustarÃa generar un incremental pero que se muestre como primer registro 0000001, y luego 0000002 y asà sucesivamente.