web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Field Mapping Multiple Lines of Text not working

(0) ShareShare
ReportReport
Posted on by 17

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! 

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,321 on at

    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

  • yvka123 Profile Picture
    17 on at

    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!

  • Community Member Profile Picture
    on at

    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.

  • Wahaj Rashid Profile Picture
    11,321 on at

    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.

  • yvka123 Profile Picture
    17 on at

    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!

  • yvka123 Profile Picture
    17 on at

    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 !!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans