Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / Fill custom field usin...
Sales forum
Answered

Fill custom field using Export in Excel Online

Posted on by 166

Hi all,

I created a custom Leads MultiSelect Option Set field (using Option Sets). I cannot fill in the field through the form as for Disqualified Leads editing is not allowed.

After preparing a view with Disqualified Leads, I exported to Excel Online and filled in the fields. Unfortunately, all failed during import.

Do you happen to have an explanation or maybe a workaround for that?

Categories:
  • Leco Lv Profile Picture
    Leco Lv on at
    RE: Fill custom field using Export in Excel Online

    Hi partner,

    Sorry for the late reply, glad you solved your problem. I overlooked the type of your field, which, as Amit said, may not be supported. Good luck!

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,801 Moderator on at
    RE: Fill custom field using Export in Excel Online

    No problem. Hope it worked .

  • ThimiosSp Profile Picture
    ThimiosSp 166 on at
    RE: Fill custom field using Export in Excel Online

    Replacing with field's names solved the issue. All codes are the same in our system.

    Can't thank you enough for this Amit, great job.

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,801 Moderator on at
    RE: Fill custom field using Export in Excel Online

    Hello,

    Please replace ak_multi with your multi select field's logical/schema name and 1 more question (refer 1st and 2nd image) can u confirm do u have other than given status reasons for qualify and disqualify status?

    For us it is 1 status code for qualify and 4 status code for disqualify status.

    Thank you,

    Amit Katariya

  • ThimiosSp Profile Picture
    ThimiosSp 166 on at
    RE: Fill custom field using Export in Excel Online

    What an effort Amit!! Greatly appreciated.

    I am getting an error on Script execution though when form loads.

    The only change I made was the JS name from "ak_AccountJS" to "new_AccountJS". I changed accordingly the last  line of script from

       formContext.getControl("ak_multi").setDisabled(false)

    to

       formContext.getControl("new_multi").setDisabled(false)

    Should I supply the error log file?

  • Verified answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,801 Moderator on at
    RE: Fill custom field using Export in Excel Online

    Hello,

    Please refer below JS which will run when your Lead is Qualified or Disqualified.

    As you can see the default Value of Qualified and Disqualified status code is from 3 to 7.

    pastedimage1673444075658v8.png

    pastedimage1673444103044v9.png

    pastedimage1673444123980v10.png

    So the given JS will run on load of a form as well as on change of Multiselect field and will save it automatically.

    function multiselectOption(executionContext)
    {
        debugger;
        var formContext = executionContext.getFormContext();
        var status;
        
        if(formContext.getAttribute("statuscode").getValue() != null)
        {  
            status = formContext.getAttribute("statuscode").getValue();
            if(status == 3 || status == 4 || status == 5 || status == 6 || status == 7)
            {
                formContext.data.entity.save();
            }
        }
    }
    
    function onload_multiselectOption(executionContext)
    {
        debugger;
        var formContext = executionContext.getFormContext();
    
        formContext.getControl("ak_multi").setDisabled(false);
    }

    Go to the Lead form and register your JS here my JS name is "ak_AccountJS".

    pastedimage1673443156255v1.png

    Then add "onload_multiselectOption" function onload of lead form. Also pass execution context to it.

    pastedimage1673443259694v3.png

    pastedimage1673443644718v6.png

    Then add "multiselectOption" function on change of the multiselect field. this function will save it automatically because we don't have save button for read only records. also pass execution context to it.

    pastedimage1673443378144v4.png

    pastedimage1673443456745v5.png

    after registering the JS make sure to publish the form and close your browser/ clear the cache.

    There is a small thing where you will have to load your lead once it is qualified/disqualified, because we don't have status code trigger point we have to load/refresh the browser so that our JS will make multiselect field as editable, once you edit the field it will automatically saves it self.

    pastedimage1673444031458v7.png

    Thank you,

    Amit Katariya

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,801 Moderator on at
    RE: Fill custom field using Export in Excel Online

     Sankalp Upadhyay ,

    For your kind information, We can not use multiselect option set in Business rule.

  • RE: Fill custom field using Export in Excel Online

    Hello ThimiosSp, you can use JavaScript or Business rule. still you are facing issue. you can reach out to me.

    Thanks,

    Sankalp Upadhyay

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,801 Moderator on at
    RE: Fill custom field using Export in Excel Online

    No problem will share a JS snippet.

  • ThimiosSp Profile Picture
    ThimiosSp 166 on at
    RE: Fill custom field using Export in Excel Online

    Really appreciate your effort but unfortunately my skills do not include JS

    Thank you anyway.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans