web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

How don't save a register if the fields are empty

(0) ShareShare
ReportReport
Posted on by 5
Hi

I am a beginner in the subject of Dynamics 365

I ask for your help to solve this problem.

I have a form, with two tables, header and detail.

I created a number sequence, so that it increases when creating a record, I attach code.

But, I have to make the sequence consume if I enter data in the form, otherwise the fields are empty, 
record should not be saved nor should the sequence be consumed. That is, if I click New,
the sequence is automatically consumed when opening the form (example: USMF-000020)
but if I do not fill in anything in the fields, when closing and reopening,
it must be the same numerical sequence, that is, USMF -000020.




Este es mi código de secuencia numérica, que se encuentra en mi formulario.


public str ConsumirSecuencia(NumberSequenceCode _secuenceGroup)
{
str voucher;
NumberSeq Ns;

try
{
Ns = NumberSeq::newGetNumFromCode(_secuenceGroup, NumberSeqScopeFactory::createDefaultScope(),
true, true);
if (Ns == null)
{
throw Exception::Error;
}
voucher = Ns.num();
Ns.used();
}
catch (Exception::Error)
{
error("No se pudo generar la sencuencia");
}

return voucher;
}





Y al correr el formulario, tengo en el código a nivel de datasource, que se inicialice con la secuencia numérica

[DataSource] class APSalesHeader
{
/// <summary> ///
/// </summary>

public void initValue ()
{
APSalesHeader.APOrderId = element.ConsumirSecuencia ('TR');
súper();
}

Por favor su ayuda. Y de antemano muchas gracias.

















I have the same question (0)
  • LuHao Profile Picture
    40,892 on at

    Hi carmen,

    Can you tell me which D365 app you are using?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 75

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 41 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans