Hi @Ivan
We can override the release action and write our logic based on the requirement.
public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry> { public delegate void ReleaseDocDelegate (List<APRegister> list, bool isMassProcess); >PXOverride] public static void ReleaseDoc (List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { // Write your logic baseDetails(list, isMassProcess); } }
Hi @Ivan The above-mentioned IF condition is wrong. Please try with below code. foreach(APRegister checkobject in list)
{
if(Base.Document.Current.PaymentMethodID.Contains(“ARTSYLPAY”))
{
// logic here
}
}
Hi @Ivan Yes, It's a static method. You cant use the Base graph here, We need to write BQL and get the value Try like below,
public delegate void ReleaseDocDelegate(List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc(List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { foreach (APRegister objAPreg in list) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), objAPreg.RefNbr);
if (payment?.PaymentMethodID=="PaymentMethod") {
} }
// Write your logic baseDetails(list, isMassProcess); }
Hi @Ivan ,
Can you try overriding any of the below method.
The “ReleaseDocProc” method is common method that would be invoked when payment are released directly from screen or processing screen.
Feel free to post for further assistance on this.
Hi @Ivan Yes, It's a static method. You cant use the Base graph here, We need to write BQL and get the value Try like below,
public delegate void ReleaseDocDelegate(List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc(List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { foreach (APRegister objAPreg in list) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), objAPreg.RefNbr);
if (payment?.PaymentMethodID=="PaymentMethod") {
} }
// Write your logic baseDetails(list, isMassProcess); }
Hi @jinin
I found this topic
It is mentioned that method ReleaseDoc is not accessible in my Acumatica
I checked it in my Acumatica ReleaseDoc method that you have provided and unforunately it is absent in my Acumatica APDocumentRelease
Hi @Ivan Please try the alternate approach like below. I verified and it's working as expected
public class APReleaseProcess_Extension : PXGraphExtension<APReleaseProcess> { #region Event Handlers //Overriding Saving method to add our logic public delegate void PersistDelegate(); dPXOverride] public void Persist(PersistDelegate baseMethod) { baseMethod();
APRegister doc = Base.APDocument.Current;
//Check for document and released flag if (doc != null && doc.Released == true && //Check for doc type. (doc.DocType == APDocType.Invoice || doc.DocType == APDocType.Check || doc.DocType == APDocType.CreditAdj || doc.DocType == APDocType.DebitAdj)) { using (PXTransactionScope ts = new PXTransactionScope()) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), doc.RefNbr);
if (payment?.PaymentMethodID == "PaymentMethod") { //write your logic }
ts.Complete(Base); } }
} #endregion } Please refer to the below document for more detailsCustom Code on AP Invoice Release - Acumatica Developers Blog
It looks like you’ve not completed T trainings yet.
I’d really recommend you to complete these training before developing things in Acumatica:
https://openuni.acumatica.com/courses/development/
Your particular question is answered in T230 training
@Ivan Hoping that above code is working.
Hi @Ivan Yes, It's a static method. You cant use the Base graph here, We need to write BQL and get the value Try like below,
public delegate void ReleaseDocDelegate(List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc(List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { foreach (APRegister objAPreg in list) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), objAPreg.RefNbr);
if (payment?.PaymentMethodID=="PaymentMethod") {
} }
// Write your logic baseDetails(list, isMassProcess); }
Hi @jinin
I found this topic
It is mentioned that method ReleaseDoc is not accessible in my Acumatica
I checked it in my Acumatica ReleaseDoc method that you have provided and unforunately it is absent in my Acumatica APDocumentRelease
Hi @Ivan Please try the alternate approach like below. I verified and it's working as expected
public class APReleaseProcess_Extension : PXGraphExtension<APReleaseProcess> { #region Event Handlers //Overriding Saving method to add our logic public delegate void PersistDelegate(); nPXOverride] public void Persist(PersistDelegate baseMethod) { baseMethod();
APRegister doc = Base.APDocument.Current;
//Check for document and released flag if (doc != null && doc.Released == true && //Check for doc type. (doc.DocType == APDocType.Invoice || doc.DocType == APDocType.Check || doc.DocType == APDocType.CreditAdj || doc.DocType == APDocType.DebitAdj)) { using (PXTransactionScope ts = new PXTransactionScope()) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), doc.RefNbr);
if (payment?.PaymentMethodID == "PaymentMethod") { //write your logic }
ts.Complete(Base); } }
} #endregion } Please refer to the below document for more detailsCustom Code on AP Invoice Release - Acumatica Developers Blog
@jinin It gives same result what was required, I am much obliged for your help
It looks like you’ve not completed T trainings yet.
I’d really recommend you to complete these training before developing things in Acumatica:
https://openuni.acumatica.com/courses/development/
Your particular question is answered in T230 training
Hi dnaumov
I understand that courses should be completed, but in my case the requirement for application quickly changed and I have not got much time. That is the reason why I am asking for help in my topics
Hi @Ivan
We can override the release action and write our logic based on the requirement.
public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry> { public delegate void ReleaseDocDelegate (List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc (List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { // Write your logic baseDetails(list, isMassProcess); } }
Hi jinin
Thank you for the provided sample of code
I need to clarify one moment
I check the Check Items by payment Method ID field
It’s system name is paymentMethodID
When I try to perform check by this field it is accessible for the entity which you have provided
How can I access this field and other Checks and Payments fields ?
For example if I do it in this way :
Here I can access Checks and Payments fields and perform my check, but such code will be workable only with “SAVE” button and I need to do same thing with RELEASE button
Hi @Ivan The above-mentioned IF condition is wrong. Please try with below code. foreach(APRegister checkobject in list)
{
if(Base.Document.Current.PaymentMethodID.Contains(“ARTSYLPAY”))
{
// logic here
}
}
Hi @Naveen B
Can you, lease, suggest what reference must be added in order to use Base ?
Intellisense does not suggest anything
Hi @Ivan The above-mentioned IF condition is wrong. Please try with below code. foreach(APRegister checkobject in list)
{
if(Base.Document.Current.PaymentMethodID.Contains(“ARTSYLPAY”))
{
// logic here
}
}
@Naveen B Please ignore my last comment
@Ivan Hoping that above code is working.
@Naveen B There is strange moment
You provided RELEASE call with static signature
It gives me an error with static definition
After I removed “static” from calling the release button the error disappeared,
But after building Acumatica gave an error
Hi @Ivan Yes, It's a static method. You cant use the Base graph here, We need to write BQL and get the value Try like below,
public delegate void ReleaseDocDelegate(List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc(List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { foreach (APRegister objAPreg in list) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), objAPreg.RefNbr);
if (payment?.PaymentMethodID=="PaymentMethod") {
} }
// Write your logic baseDetails(list, isMassProcess); }
Hi @jinin
Thank you for the response
After building project I am receiving the following error, when I am trying to Open CHECK item
All my code
Can you, please, suggest what causes the problem ? Maybe wrong method is used for Acumatica 2021R2
Hi @Ivan Yes, It's a static method. You cant use the Base graph here, We need to write BQL and get the value Try like below,
public delegate void ReleaseDocDelegate(List<APRegister> list, bool isMassProcess); PXOverride] public static void ReleaseDoc(List<APRegister> list, bool isMassProcess, ReleaseDocDelegate baseDetails) { foreach (APRegister objAPreg in list) { APPayment payment = PXSelect<APPayment, Where<APPayment.refNbr, Equal<Required<APPayment.refNbr>>>>.Select(new PXGraph(), objAPreg.RefNbr);
if (payment?.PaymentMethodID=="PaymentMethod") {
} }
// Write your logic baseDetails(list, isMassProcess); }
Hi @jinin
I found this topic
It is mentioned that method ReleaseDoc is not accessible in my Acumatica
I checked it in my Acumatica ReleaseDoc method that you have provided and unforunately it is absent in my Acumatica APDocumentRelease
Hi @Ivan ,
Can you try overriding any of the below method.
The “ReleaseDocProc” method is common method that would be invoked when payment are released directly from screen or processing screen.
Feel free to post for further assistance on this.
Hi @deebhane
Thank you for the provided samples of code.
I receive such error for Method Release in the first example
With second Method ReleaseDocProc everything seems to be okay
As you have mentioned above - I can use any of these methods, I will use the second
I need to clarify two moments with it. The first one - how to extract data for Check and Applications Item inside this method ? For example PaymentMethodID field is absent in doc variable
How to extract Check and Applications fields and columns from Documents to Apply table ?
The second moment is it enough if I just end method in such way ?
I mean is there any data that must obligatory assigned or returned ? I need to clarify it in order omit the corruption of the Acumatica project