Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Extract specific line from Multiple Lines of Text and copy to another field

Posted on by 3,070

Hi guys,

I was wondering if it is possible to identify a specific line within a Multiple Lines of Text field and copy the value to a seperate field?

In my organisation, we have Leads created from our Online Shop using a Zapier plugin.  One of the fields that is created copies all of the Line Item data from our shop to our CRM system in a Multiple Lines of Text field.  I would like to extract a specific line from this field and copy it to another field.

The data that is generated is as follows:

categories: XXXXX
item_meta: []
line_subtotal: 0.00
line_subtotal_tax: 0.00
line_tax: 0.00
line_total: 0.00
name: Product Name
product_id: 25101
quantity: 1
sku: HSE02
tags:
tax_class:
type: line_item
variation_id: 0

I would like to take the data from the line that begins "Name:" as this is the specific product that is being purchased and I'd like to make it easier for my users to find.

I hope this makes sense...

*This post is locked for comments

  • Verified answer
    Ryan Maclean Profile Picture
    Ryan Maclean 3,070 on at
    RE: Extract specific line from Multiple Lines of Text and copy to another field

    For anyone else reading this, I managed to accomplish what I was looking for by using the Business Process Activities Formula Manager from North 52 (www.north52.com/.../formula-manager-for-microsoft-dynamics-crm-xrm).  This allowed me to turn an Excel formula into a function on CRM relatively easily.

    I'm sure this could have been accomplished with jscript or using a number of custom workflow activities, but this was the simplest method for my specific situation

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Extract specific line from Multiple Lines of Text and copy to another field

    You can use this pack of custom workflow activities - jlattimer.blogspot.com/.../crm-string-workflow-utilities.html

    It contains mentioned Regular Expression.

  • Ryan Maclean Profile Picture
    Ryan Maclean 3,070 on at
    RE: Extract specific line from Multiple Lines of Text and copy to another field

    Hi Andrii,

    I was hoping for a no-code solution ideally.  I'm not particularly adept at jscript and I'd like to make it easy to maintain going forward.  

    Frustratingly I can achieve this easily in Excel with a combination of MID and FIND functions.  I've looked at North52's BPA solution and I think it might work, if I can figure out the logic

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Extract specific line from Multiple Lines of Text and copy to another field

    Hello,

    Have you considered usage of regular expressions like:

               var sourceString = @"categories: XXXXX

    item_meta: []

    line_subtotal: 0.00

    line_subtotal_tax: 0.00

    line_tax: 0.00

    line_total: 0.00

    name: Product Name

    product_id: 25101

    quantity: 1

    sku: HSE02

    tags:

    tax_class:

    type: line_item

    variation_id: 0";

               Regex regex = new Regex("name: (.*)\r\n");

               var v = regex.Match(sourceString);

               string s = v.Groups[1].ToString();//should be 'Product Name'

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans