ICT/Microsoft Dynamics 365

[D365] Client script for OnLoad event

NeoSailer 2025. 1. 8. 16:09

This will guide you the basics of D365 client script which works in forms.

The script will be triggerred by Onload event displaying messages and update fields.

 

#1. Go to Power App page

https://make.powerapps.com/

 

Power Apps

 

make.powerapps.com

 

#2. Select "Tables" on the left menu pane then select "Accounts" on the main pane

 

#3. Select "Forms" under "Data experiences" 

 

#4. Select "Account"

 

#5. On the left menu pane, click "Form libraries"

 

#6. Select "+ Add library"

 

 

#7. Select "+ New web resource"

 

#8. Upload JavaScript file by selecting "Choose file" then save the file

 

this.formOnLoad = function (executionContext)
{
    var formContext = executionContext.getFormContext();
    formContext.ui.setFormNotification("Hellow world v2", "INFO","IDUnique20250107");
    

    if(!(formContext.getAttribute("fax").getValue()))
    {
        formContext.getAttribute("fax").setValue("123-4567")
        formContext.ui.setFormNotification("Fax information has been filled", "INFO","IDUnique20250107");
    }
    
}

 

#9. Select form > "Events" >  "+ Event Handler" and input a handler name which is "formOnLoad"

 

#10. Go to PowerApp page, https://make.powerapps.com/

 

#11. Select Account app then you can see messages popping up and fax field being automatically filled up

반응형