cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Cascading Rules Not Working During the Creation Phase of an Object Created via API

Emrec@n
8-Gravel

Cascading Rules Not Working During the Creation Phase of an Object Created via API

Version: Windchill 12.1

 

Hello,

I am creating an object with a problem report subtype using an expression robot within a Windchill workflow. There are some cascading rules defined in the created problem report based on the Role value. For example, when the Role value is set to Software Quality Engineer, attributes X, Y, Z, A, and BC should be hidden. However, even though I set the Role value to Software Quality Engineer while creating the object, the cascading rules do not apply during the object creation, and all attributes are visible on the info page after the object is created. The cascading rules only work on the Edit page, but even if the object is edited in this way, the info page is not updated. How can I resolve this issue? I am eagerly awaiting your suggestions. @HelesicPetr 

 

Additionally, the default values for the attributes are not appearing in the object I created with the code below. The info page is completely empty, showing only the attribute names.

 

I am sharing the code snippet I used below.

 

// Create an instance of subtype of Change Request 
		wt.fc.ReferenceFactory rf = new wt.fc.ReferenceFactory();
		wt.fc.WTReference context_ref = (wt.fc.WTReference) rf.getReference("OR:wt.pdmlink.PDMLinkProduct:152306");

		java.util.Locale locale = wt.session.SessionHelper.getLocale(); 
		com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter("WCTYPE|wt.change2.WTChangeIssue|tr.com.aselsan.Software_Verification_Plan_Checklist1", locale, new com.ptc.core.meta.common.CreateOperationIdentifier());
		obj.load("name","containerReference","rol");
		obj.set("name", "test PR 002");
		obj.set("containerReference", context_ref);
                obj.set("rol", "Software_Quality");
                obj.validate();


		
		wt.change2.WTChangeIssue Pr2 = (wt.change2.WTChangeIssue)obj.apply();  

		// Assign iteration creator before saving
		wt.vc.VersionControlHelper.assignIterationCreator((wt.vc.Versioned) Pr2, participantRef);

		Pr2 = (wt.change2.WTChangeIssue) wt.fc.PersistenceHelper.manager.save(Pr2);
		Pr2 = (wt.change2.WTChangeIssue) wt.fc.PersistenceHelper.manager.refresh(Pr2);

		// Link to the Problem Report(primaryBusinessObject) 
		wt.change2.ChangeProcessLink changeProcessLink = wt.change2.ChangeProcessLink.newChangeProcessLink((wt.change2.WTChangeReview)primaryBusinessObject, Pr2);
		wt.fc.PersistenceHelper.manager.save(changeProcessLink);

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:Emrec@n)

Hi Emrec@n 

I would say, that the cascading rules are defined in a wizard somehow.

Your wizard does not contains the rules and also your processing code does not contains any check that something is not defined ok.

So I would try to find how the cascade rules works and check the source code how to apply it to the own solution.

PetrH

View solution in original post

6 REPLIES 6

Hello.

It seems that there is no one available to help with this issue. I found a method in the Java Doc that I think could be used to enable cascading: . However, I don't know how to use it. Do you think this method might work?"

 

"com.ptc.core.components.forms.CreateAndEditModelGetter.enableCascadingAttrs"
HelesicPetr
22-Sapphire I
(To:Emrec@n)

Hi Emrec@n 

I would say, that the cascading rules are defined in a wizard somehow.

Your wizard does not contains the rules and also your processing code does not contains any check that something is not defined ok.

So I would try to find how the cascade rules works and check the source code how to apply it to the own solution.

PetrH

@HelesicPetr  I want to modify my question as follows: After creating the object, I manually select the role by clicking Edit, and at this stage, some attributes become hidden. When I save and exit, the attribute values are updated, but the attributes that should be hidden are not actually hidden. How can I ensure that the attributes are properly hidden?

HelesicPetr
22-Sapphire I
(To:Emrec@n)

Hi Emrec@n 

The values are not hidden in your wizard or in general detail page?

PetrH

@HelesicPetr ,

 

No, they are not hidden. They are only hidden on the Edit page; however, the attributes that should be hidden are visible in other areas.

Based on your guidance, I rechecked and identified a very simple mistake. I had defined the Role attribute in the Primary Attributes Info Page Layout, while the other attributes were defined in the More Attributes Info Page Layout. The cascading attributes were not being updated because they were not in the same layout. Since I could see all attributes when I opened the info page, I didn't notice this. After I added the Role attribute to the More Attributes Info Page Layout, the issue was resolved. Thank you for your support. @HelesicPetr 

Announcements

Top Tags