x++


Number sequence AX 2012


I have gone through msdn article, read whitepaper on number sequences and made number sequences a lot many times. But in this scenario I need some help.
Scenario is; I want to get next sequence number through x++ code using just number sequence code and no reference etc.
I have tried following (and many others but this is nearest solution) ;
static void myTestJob(Args _args)
{
NumberSeq num;
num = NumberSeq::newGetNumFromCode('SAO-Y');
info(num.num()) ;
}
It generates number sequence against some number sequence codes, but for other it throws error that;
"Number sequence does not exist."
I have tried many other options mentioned on many other blogs and tried to explore AX as well, but now need some assistance.
P.S. I'm not creating number sequence using x++ code but from front end (organization administration).
I am able to suppress the exception by using following;
num = NumberSeq::newGetNumFromCode(<<someNumberSequenceCode>>, NumberSeqScopeFactory::createDefaultScope(), true, true);
As, fourth optional parameter of NumberSeq::newGetNumFromCode(,,,true); says not to throw exception on missing reference.
boolean _dontThrowOnMissingRefSetUp = false,
As I said earlier, I have created number sequence from organization administration without writing any code (EDT, class, parameters table etc. stuff) so no reference was generated and I think I was getting exception due to this.
Please have a look at your number sequence that you have set up. I recon it has something to do with the numbersequence scope.
Make sure the scope of the number sequence is valid within the company you are calling this.
It's work, but not raice result: Voucher not generated.
Working way:
num = NumberSeq::newGetNumFromCode(<<someNumberSequenceCode>>,
NumberSeqScopeFactory::createDefaultScope(), **false**, true);
When my Number Sequence - Scope is setup as Shared I can use this code:
numSequence = NumberSeq::newGetNumFromCode(<<someNumberSequenceCode>>, NumberSeqScopeFactory::createDataAreaScope(curext()), true, true);
When my Number Sequence - Scope is setup as Company I can use this code:
numSequence = NumberSeq::newGetNumFromCode(<<someNumberSequenceCode>>);

Related Links

Regarding X++ query
MultiSelectionHelper not working as expected
Sorting by custInvoiceJour.Dimension
Refresh the main screen in ax dynamics 2009
How to insert into a table field with value from a display method dependent of string
x++ cannot read registry entry
How do I get the caller Form's name in the Insert() of a table in AX 2012?
How to lookup into another table using EDT AX 2012
Set a Date Value to a Date Field in AX2012
Determine if a job is running in X++ code
Dynamics AX 2012 parsing Int32 to table field integer
Cancel Sales order packing slip through x++
Transferring open account records between customers
How to make sure that a form is only opened once?
Extend system menu in Dynamics AX 2012?
How to show selected items of certain table on the different table in Dynamics AX 2012?

Categories

HOME
sonarqube
google-app-engine
search
kentico
time-complexity
wakanda
pagination
sitecore
telegram-bot
retrofit2
vert.x
barcode
opengl-es-3.0
filechannel
android-intent
do-while
digital-signature
google-maps-autocomplete
googlebot
blade
highstock
itunes
jackson-modules
genexus-sd
browser-sync
realm-mobile-platform
angularjs-material
simplecv
hreflang
nested-lists
browser-extension
fiware-cygnus
watchman
sessionstorage
projects-and-solutions
gdata
css-position
news
xv6
dcmtk
oim
user-defined-fields
azure-cli
cup
check-mk
quicktime
payload
java-websocket
reachability
stripe-connect
cudd
cubism.js
simevents
jclouds
clipboard.js
cfchart
pushbots
toast
phpgrid
vhosts
google-books
toolkit
dulwich
code-documentation
openbabel
variadic-templates
angular-gettext
uncaught-typeerror
sip-server
cocos3d
jqmodal
codeplex
tinyxml
multitasking
jeromq
monotouch.dialog
veracity
correlated-subquery
cuda-gdb
josql
usertype
ikimagebrowserview
jquery-tools
htdocs
tournament
w3c-geolocation
massive
hbm2java
application-verifier
sifr
murmurhash
lxr
lalr
windows-identity
escrow
fdf
flvplayback
technical-debt
java1.4
leader

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App