Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

To throw message when we click on the field on form

(0) ShareShare
ReportReport
Posted on by 1,479
hi 
when i click on product recipt form when the form opens i need to show the warning message , /you need to add transport charges to view charges in this po / how can i get this done plz  anyone have suggestion which method i need to use the form is in the purchase order form >product recipt 
 
thanks,
regards,
Dinesh
 
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    To throw message when we click on the field on form
    hi martin 
    thanks for suggestion ,
     
    i will try to figure it out using the dialog method
     
    thanks,
    dinesh.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    To throw message when we click on the field on form
    It's a pity that you didn't trust me what I told you that (twice), but now you see that I indeed wasn't kidding.
     
    I see two options:
    1. Either you'll put the logic to a class specific to product receipt, such as PurchFormLetter_PackingSlip, that I mentioned before. You could use dialog() method, for instance.
    2. Or you'll take into account the type of purchFormLetter variable in PurchEditLines form.
    You also managed to add two new bugs:
    1. As usual in your code, you forgot to initialize the variable you're using in "if" statement. You should start paying attention to it when you know you forget about it so often. You should also start testing your code.
    2. The call of PurchFormLetter_PackingSlip in init() is absolutely meaningless and wrong. Throw it away.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    To throw message when we click on the field on form
    Hi martin ,
    thanks for reply ,
     actually i am having issue , with this code , it is throwing this info on all the menu item where  i click reciept list, product recipt and on confirm of PO 
    I just want to show it on product recipt i have added the below code but no use , can you plz guide me on this .
    [ExtensionOf(formStr(PurchEditLines))]
    internal final class DT_ProductReciept_Extension
    {
    	public void init()
        {
            Args    args;
            FormRun   purchEditLinesForm;
    
            next  init();
            args = new Args();
    
            if (!purchEditLinesForm)
            {
                purchEditLinesForm = new menufunction(menuItemActionStr(PurchFormLetter_PackingSlip) , MenuItemType::Action).create(args);
                Info(strFmt("%1",'ATTENTION:YOU NEED TO ADD TRANSPORT CHARGES TO VIEW CHARGES IN THIS PO'));
            }
           
        }
    
    }
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    To throw message when we click on the field on form
    As I explained, this doesn't meet your requirements because it's not limited to postings of product receipt.
     
    By the way, you can throw away the call of strFmt(), because it doesn't have any effect there.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    To throw message when we click on the field on form
    hi martin ,
    thanks for reply ,
    i have written this code it is just showing normal info message , that's how they want it .
    i know it is not the right way but , it will work for now ,
    [ExtensionOf(formStr(PurchEditLines))]
    internal final class DT_ProductReciept_Extension
    {
    	public void init()
        {
            next  init();
            Info(strFmt("%1",'ATTENTION:YOU NEED TO ADD TRANSPORT CHARGES TO VIEW CHARGES IN THIS PO'));
        }
    }
    
    thanks ,
    dinesh
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    To throw message when we click on the field on form
    Didn't you forgot the requirement about "this PO"?
     
    Just adding to init() method of the dialog form (without further conditions) would be a bug, because then it would run for all PO postings and not just product receipt. The logic belongs to classes specific to product receipt.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    To throw message when we click on the field on form
    when i  click on product recipt and the dilog opens the warning should popup no other condition is there .
    should ineed to use the init method of form . 
     
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    To throw message when we click on the field on form
    Okay, that answer some of the questions, but not all. Please answer the rest too.
     
    We can't choose the right place for the logic without knowing what the logic should do and therefore when it must run.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    To throw message when we click on the field on form
    hi martin ,
    thanks for reply 
     
    i just want to show the warning when the dialog opens . no other requirement , can you plz tell me how can i get this done so the warning popup each time the dialog opens 
     
     
    thanks ,
    dinesh
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    To throw message when we click on the field on form
    You didn't do your research properly - the purpose of the button isn't opening a form. The goal is running a product receipt posting, therefore the button calls PurchFormLetter_PackingSlip class. Showing the dialog is just one step in the process. Also, this button is not the only way how to run the posting (and therefore seeing the same dialog).
     
    You're also wrong to assume that there always is "this po", because there may be more than one or none at all. You need to take these scenarios into account.
     
    Is your intention to just show the warning, but still allow posting anyway?
     
    Do you want to evaluate the condition for POs that the dialog was opened for, or the one actually used for posting? These may be two different things, because users can add and remove purchase orders from the list.
     
    Do you want to show (or rather log) the warning even if the posting is run with late selection?

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

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans