Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

extract string from response submitted



I have a text field in the form which user can enter any number of characters, I am storing details of this form in common data service. As the text column in cds will accept max to 4000, my flow is got failed when character length is more than 4000.

I tried to add an expression mentioned below to extract first 4000 characters when i am inserting record. However am getting below error.


I tried below substring functions in expression 


substring(triggerBody()?['Reason/Business justification'],1,4000)

error : One or more fields provided is of type 'Null', a different type is expected.

error : Unable to process template language expressions in action 'Create_a_new_record' inputs at line '1' and column '90440': 'The template language function 'substring' parameters are out of range: 'start index' and 'length' must be non-negative integers and their sum must be no larger than the length of the string

Can someone please help/suggest me how i can get first 4000 characters when i am inserting data to cds

Thank you!



Screenshot from 2020-08-19 23-40-56.png


Dual Super User II
Dual Super User II

Hi @SaiRupa 


Here is your expression. Note: Index starts from 0.


if(greater(length(outputs('Get_response_details')?['body/rd07b3c96a0264658bbc3ace8b3711eb9']) ,4000),substring(outputs('Get_response_details')?['body/rd07b3c96a0264658bbc3ace8b3711eb9'],0,4000),outputs('Get_response_details')?['body/rd07b3c96a0264658bbc3ace8b3711eb9'])


If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Reza Dorrani, MVP

Helpful resources

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (91,521)