Another question for Configurator experts

Ok, this one has me good and stumped. I’m hoping someone might help me debug this one.

I’ve automated our Product Configurator and this all works well for the best part. I’ve recently rewritten this into functions which, again, is working really well. However, I’ve got a problem with a couple of products that use a smart string to switch part numbers.

When manually running the configurator, the new part number is constructed from a single textbox. The smart string then updates the part number as the configurator completes.

During our automation I’m having trouble running the method responsible for updating the part number. I think I’ve tracked down what I need to run but I’m not able to work out the format of the parameter I need to feed into this method.

Running my trace log, I think the method I need to use is Erp.BO.ConfigurationRuntimeSvc/SuggestSmartString.
Looking at the swagger, one of the parameters needed is:
image
After a little digging, I’ve worked out I need to add areference to Erp.Shared.Lib.Configurator and use a list with a PCKeyValuePair as this parameter. I can’t find what information this key/value is looking for though. I’m guessing it’s the textbox name and value, but I can’t get it to work.

I can code it as follows:

System.Collections.Generic.List<Erp.Shared.Lib.Configurator.PCKeyValuePair<System.String,System.String>> lPCKey = new System.Collections.Generic.List<Erp.Shared.Lib.Configurator.PCKeyValuePair<System.String,System.String>>();

Erp.Shared.Lib.Configurator.PCKeyValuePair<string,string> pcKeyPair = new Erp.Shared.Lib.Configurator.PCKeyValuePair<string,string>();
pcKeyPair.Key = "textboxname"; // not sure about these but I feed them in
pcKeyPair.Value = "textboxvalue"; // as strings with the correct name and value of the textbox

lPCKey.Add(pcKeyPair);

boPC.SuggestSmartString(sconfigID, false, ref tsPcSeq, "OrderDtl", tsPCRuntime.PcValueGrp[0].RelatedToSysRowID , lPCKey, out sNewPN, "/0", 0);

My trace log for this method doesn’t show values that are passed through, it only shows this:

<parameter name="smartStringValues" type="System.Collections.Generic.List&lt;Erp.Shared.Lib.Configurator.PCKeyValuePair&lt;System.String,System.String&gt;&gt;"><![CDATA[System.Collections.Generic.List`1[Erp.Shared.Lib.Configurator.PCKeyValuePair`2[System.String,System.String]]]]></parameter>

How am I able to find what information I need to pass into this parameter???

@josecgomez hope you don’t mind the tag but you’ve helped me lots in the past! Any ideas? Anyone else?

I hope this all makes sense - it’s late here and my brain hurts!

Thanks in advance!

Ryan.

@ckrusen I see you’ve dabbled with suggestSmartString here. Did you work out what this parameter needed to have passed in to generate the new part number?

Cheers,

Ryan

I never had to do anything fancy. I built the desired part number as a string in a field on the configurator. Then made the “smart string” just equal to the text field’s value.

So I wasn’t really having the Smart String build the desired value.

Thanks for the reply Calvin.

I’m running the configurator BOs without opening the configurator forms and populating the inputs via code. I can see that I need to run SuggestSmartString and PartExists methods, without these the smart string from inputs doesn’t update when the configurator saves and the part number won’t be replaced.

Like you mentioned in your post, the partnum isn’t visible until the PartExists method, but unfortunately without the smartStringValues parameter in SuggestSmartString the new partnum isn’t generated and it only returns an empty string.

Any idea how I could identify what values are being passed through the parameter??? Trace log doesn’t seem to help much with this one, I only see System.Collections.Generic.List`1[Erp.Shared.Lib.Configurator.PCKeyValuePair`2[System.String,System.String]] as the value being passed in. Every combination of PCKeyValuePair strings I pass in only seems to return an empty string.

Any help appreciated!

Hi RJM, I was running into the same issue and stumbled across your post. your code helped me figure out how to get the smart string.

I was able to get the method to work with the correct values in the KeyValue Pair.

Enter in the Input and the Value from the Record Creation screen on the configuration. can find this data in the PcStrComp table in the dataset

1 Like