Get first two characters of text field

1.1k Views Asked by At

I have a text field X where User can write a long or a short string. In an other text field Y, I need to get the first two caracters of that field X. I don't want to do this with JS since it will not be executed if a record is created with import. Is there any way to do this without using c# plugin?

Thanks in advance,

2

There are 2 best solutions below

0
On

You will need to either use either a plugin or custom workflow activity for this.

Luckily, Gap Consulting provide a custom workflow activity which should hopefully suit this.

Download and install Gap Consulting Workflow Essentials (it's free).

Create a workflow and then use the custom workflow activity, Gap String Functions > Gap.StringFunctions.SubString.

Inputs:

  • Text: Field X
  • From Left to Right: True
  • Start Index: 0
  • Length: 2.

You can then copy the output from that into field Y.

Full discloure; I work for Gap Consulting

0
On

Manipulation Library can help you too for CRM 2011.

You should pick the method ManipulationLibrary.Strings.Substring. Its use is exactly the same as James Wood describes for his tool.

Inputs:

  • Text: Input field
  • From Left to Right: True
  • Start Index: 0
  • Length: 2