cancel
Showing results for 
Search instead for 
Did you mean: 

SAP C4C Add text to textCollection

0 Kudos
546

Hello I am new to C4C but as even my seniors can't solve this issue I came for you for help.

I am suppose to update singlenotehistory standard component, on it's own its work perfectly.

I tried to update it using manually(using admin in the browser) and saw using query that it updates text with type code "10034" (Account Note).

I need to add by code some text But as I try to use create on the text it throws error:

The trigger is custom action on account header Using EC.

getting the account header:

var query = BusinessPartner.QueryByIdentification;
	var selectionParams = query.CreateSelectionParams();
	selectionParams.Add(query.UUID.content, "I", "EQ", tmpCustomerUUID.content);
	var resultData = query.Execute(selectionParams).GetFirst();
if (resultData.IsSet())
	{
		var textCollection;
		if (!resultData.TextCollection.IsSet())
			textCollection = resultData.TextCollection.Create();
		else
			textCollection = resultData.TextCollection;


		if (textCollection.IsSet())
		{			
		//if (!n.Text.GetFirst().IsSet())
		//{
		var tmp1 = textCollection.Text.GetFirst();
		if (textCollection.Text.Count() == 0)
		{
			var textEle : elementsof textCollection.Text;// textCollection.Text;
			textEle.TypeCode.content = "10034"; // Account Note    // 10006
			textEle.LanguageCode = "HE";
			var textIdentity = resultData.TextCollection.Text.CreationIdentity;
			var text = resultData.TextCollection.Text.Create(textEle);//error msg here text is initial
					    						
			var textContent;

			if (text.TextContent.IsSet())
			{
				textContent = text.TextContent;
			}
			else
			{
				var textContentEle : elementsof text.TextContent;
				textContent = text.TextContent.Create(textContentEle);
			}
			textContent.Text.content = "account note test";

		}
	}
}
		}	 
	}

Accepted Solutions (0)

Answers (0)