on 2021 Dec 21 10:35 AM
Hello experts,
Let's say we have a Quote that has two items like down below;

Selected 'Vehicle Code' for item 'SCS' on configurator;

Selected 'Vehicle Code' for item 'SLA_Y' on configurator;

We have global script which we are calling as a custom event on Quote page.
We would like to read selected attribute values of each item on this script.
Here is the example code;
for a in Quote.MainItems:
a.Edit()
Trace.Write('--------------->>>'+Product.PartNumber)
Trace.Write('--------------->>>'+Product.Attr('Vehicle Code').SelectedValue.ValueCode)
Here is the trace;


PartNumbers are correct but selected values of "Vehicle Code" attributes are wrong. Second iteration also fetches first products selected attribute value.
Anyone knows why this problem occurs and how to fix it?
Best regards.
Request clarification before answering.
Mehmet,
I don't have enough experience to know why this isn't working for you, but I can offer some alternative methods.
I know this is stupid, but I better ask - are you sure that the value code of both of those values isn't the same? You show the display values in the drop down, but you pull the value codes.
1. If you must have the script edit the item (which isn't necessary unless you're also changing things), then you could simply use this tag:
Trace.Write(TagParserProduct.ParseString("<*VALUE(Vehicle Code)*>"))
for a in Quote.MainItems:
for b in a.SelectedAttributes:
if b.Name == 'Vehicle Code':
for c in b.Values:
Trace.Write("Vehicle Code: " + c.Display + ", " + c.ValueCode)You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.