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

Having button that runs code, but doesn't submit data to (or validates against) table
Where are Duties (table name) stored in AX?
Advanced query range
How to read from an Excel file?
group by clause in X++
Determine the number of affected rows by an update_recordset call in Dynamics 4.0?
how to protect the x++ source code
About Data Dictionary
setTimeOut and local function
Passing FromControl in a lookup override method
Reference control from datamethod in generated design
Extended EDT does not compare dates
How to display a tooltip in Dynamics AX 4.0?
how to disable intellisense in ax2012's code editor?
How do you “Run” a class
General quesions about Dynamics Ax

Categories

HOME
windows
phantom-dsl
google-cloud-platform
paraview
deep-learning
time-complexity
wakanda
fpga
pagination
jelastic
shiro
knitr
owl-carousel
newrelic
alsa
cq5
3d-reconstruction
bookmarks
pega
rtf
dynatrace
gource
jmp
event-store
jquery-callback
angularjs-components
delimiter
ms-access-2003
carrierwave
constexpr
panoramas
scatter3d
r-grid
fstream
openwhisk
joomla2.5
reactjs.net
fiware-cygnus
magento-1.9.2.4
reactivekit
amazon-ses
z-notation
projects-and-solutions
recurrent-neural-network
metaprogramming
css-position
cin
azure-arm
xv6
naming
install.packages
chronicle-map
oracle-service-bus
tcc
ovf
twilio-click-to-call
tf
bluez
qtranslate
context-sensitive-grammar
cmp
django-1.10
structuremap4
rsa-archer-grc
simplepie
mapxtreme
beamer
rspec2
mapinfo
ng-grid
clipboard.js
redis-cluster
nullable
pypiserver
jdi
rate-limiting
extjs-grid
pax-exam
rpart
linked-tables
botan
zend-currency
theos
viewer
android-vibration
ghcjs
device-tree
tweenlite
ora-00904
spring-remoting
paste
authlogic
multitasking
solace-mq
scrypt
breakout
preload
qtconcurrent
hibernateexception
pinch
xui
quotation-marks
ruby-1.8
data-mapping
cuda.net
ifilter

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App