I'm trying to call a codeunit that has the following filter
grecCustLedgEntry.SETFILTER("No.",'%1',"CLE No."+'*');
the field grecCustLedgEntry."No." has a max length of 20 characters, when the value of "CLE No." is 20 characters long the web service throws an error "The maximum length for a string value is 20.". I think that the wildcard * that I'm adding at the end of the filter is being considered in the total length. I've tested the same code from classic client and it works fine.
Has anyone come across this issue?
0
Comments
if you want to apply filter of more than 20 character using special character like '*','|' then donot use %1. You should create String filter first then you should apply filter directly as shown below:
Filterstring := "CLE No."+'*';
grecCustLedgEntry.SETFILTER("No.",Filterstring);
If Tips is useful and solved problem then please donot forget to mark it as solved.
I already found a way to work around the issue by doing grecCustLedgEntry.SETFILTER("No.",'%1',copystr("CLE No."+'*',1,20)); but I guess what I was looking for is if there's a hot fix for this as this issue seems to be a glitch in the Web services, as stated in my initial post the code works fine in classic client. My goal is not to have to go through all the code to try and find filters that could potentially have the same issue.
Taking care of string lengths in your code is always a good idea by the way.
RIS Plus, LLC