Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Field Mapping Multiple Lines of Text not working

Posted on by 162

Hi friends, 

I am stuck at a field mapping situation and just can't find the issue here... 

It concerns Products and Quote Products: Because we are using templates to create Quotes I have mapped the standard description field of the product to the quote product (1:N relationship) - this works just fine. In this way, users can look for the product they want to add to their quote and see right away the description of the existing product. This field is also used in our Quote template - so the users have the text filled in automatically but could still make changes without editing the initial description of the actual product. Hope I explained it clearly. 

Now I have created a custom field (Multiple Lines of Text with max length. 1.000) for Product and created another Multiple Lines field with the same max. lenght for Quote Product. I wanted to map it the same way that I mapped the standard description field - but for some reason it just does't work. 

The value of my custom field is just not copied into the quote product... I am absolutely clueless where the issue could be - I have made sure that it is exactly the same type of field and it is both shown on the form. 

Does anyone have an idea whats going on? Am I missing a requirement? 

Source: 

pastedimage1622039873520v2.png

Target:

pastedimage1622039830305v1.png

Thank you so much in advance for your help! 

  • yvka123 Profile Picture
    yvka123 162 on at
    RE: Field Mapping Multiple Lines of Text not working

    Hi,

    I have one additional question that now popped up after using it for a while:

    When the user updates the field in the quote product, it should not be changed back to the product field.

    In the flow trigger I can only chose "Create or Update" but it should only update the first time the quote product is created.

    Once its created, the description field should be able to be editable.

    But the flow shows me an error if I chose the trigger to be "Create" only - is there a way to restrict this??

    Thank you !!

  • yvka123 Profile Picture
    yvka123 162 on at
    RE: Field Mapping Multiple Lines of Text not working

    Thank you so much both of you!! Super great help!

    I went with Leah's option - I think we can live with that few seconds that it takes to see the text.

    Thank you so much again for your great support!

  • Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Field Mapping Multiple Lines of Text not working

    Hi,

    If you need to populate the text immediately after a product is selected, you have to use the JavaScript.

    Otherwise, you can use the approach provided by Leah (but it will run asynchronously, this means the description will be copied with a noticeable delay).

    If you need help with the JavaScript function, feel free to ask.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Field Mapping Multiple Lines of Text not working

    Hi yvka123

    The product and the quote product is 1:N relationship, so you need populate one field of child records with value from parent record.

    Maybe you can try to use power automate to create an automated flow to achieve it, which is a no-code way.

    1.Go Power Automate(https://us.flow.microsoft.com/en-us/ )

    pastedimage1622094632202v3.png

    2.Set trigger:

    pastedimage1622094819778v4.png

    3.Add condition action.

    pastedimage1622095245201v5.png

    4.Add 'Get a row by id' action under yes branch.

    pastedimage1622095337382v6.png

    5.Add Update a row action.

    pastedimage1622095511582v7.png

    Overview of the flow:

    pastedimage1622095557276v8.png

    6.Test:

    pastedimage1622095715053v9.png

    Create a quote line with the product: P1

    pastedimage1622095754285v10.png

    After clicking save button and refresh button, the description EN field of quote product has been filled with value from P1 product automatically.

    pastedimage1622095847794v11.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • yvka123 Profile Picture
    yvka123 162 on at
    RE: Field Mapping Multiple Lines of Text not working

    Hi Wahaj,

    thank you for your reply! That's really a bummer, I thought since it works for the standard fields, why wouldn't it work with custom fields..

    Unfortunately I have no experience at all with coding so I really don't know where to insert or how to apply what you proposed.

    I might try to find a different out of the box solution for our situation without coding..

    Thanks again!

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Field Mapping Multiple Lines of Text not working

    Hi,

    Relationship mapping for this relationship (Existing Product) is not configurable.

    Register following sample function on change of the Existing Product lookup to set the multi-line field:

     

    function SetProductDescription(executionContext)
    {
        const formContext = executionContext.getFormContext();
    
        // Get Existing Product Lookup Value
        const existingProd = formContext.getAttribute("productid").getValue();
    
        if (existingProd)
        {
            const id = existingProd[0].id;
            const entityType = existingProd[0].entityType;
         
            // Get Description from the Product
            Xrm.WebApi.retrieveRecord(entityType, id, "?$select=description").then(
                function success(result)
                {
                    const description = result.description;
                    console.log("Retrieved Description:"   description);
    
                    // Set Description Field on Quote Line
                    formContext.getAttribute("description").setValue(description);
                    
                },
                function (error)
                {
                    console.log(error.message);
                }
            );
        }
    }

    I am copying Product Description to Quote Line Description, you may rename the field names as per your need.

    Also, do not forget to pass the execution context as the first parameter.

    Here is how it should be registered:

    pastedimage1622055674413v1.png

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans