Skip to Main Content

E-Business Suite

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to validate SCRM work flows.

kiran budhaDec 13 2019 — edited Dec 25 2019

Hi

I am trying to validate SCRM work flows in PLM .But I am not able to implement.

Could you please some one help me ?

My scnario: If faclity is not added in Sourcing Approval in SCRM module  then I should show error message when approving Sourcing approval from Draft to approved.

Condtion: SA should be assigned to  "Supplier Approval Workflow - Production Ready Packaging Material"  workflow.If SA is assinged to other workflow then it should not validate faclity field.

1.Added workflow tag 1056 and 1057

2.I have added below code in Validationsetting file.

<ValidatorFactories>

<add key="SCRMSAfacilityValidator" value="Singleton:SourcingApprovalHandler.SCRMSAfacilityValidatorFactory, SourcingApprovalHandler"/>

</ValidatorFactories>

<rule type="5012">

<condition event="workflow" >

<if type="SpecWorkflowSystemActionValidator" property="SourcedSpecification" report="false" checkTargetState="true" behaviorId="1056">

<if type="SCRMSAfacilityValidator" report="true" />

</if>

<if type="SpecWorkflowSystemActionValidator" property="SourcedSpecification" report="false" checkTargetState="true" behaviorId="1057">

<if type="SCRMSAfacilityValidator" report="true"/>

</if>

</condition>

</rule>

---------------------------------

3. C# CODE:

namespace SourcingApprovalHandler

{

    internal class SCRMSAfacilityValidator : BaseValidator

    {

        public override bool Validate(IValidationContext ctx)

        {

            Assert.True(ctx.ValidationTarget is ISourcingApproval);

            var retval = true;

            var saf = (ISourcingApproval)ctx.ValidationTarget;

            if (saf.fkFacilityID == null)

            {

               

                    ctx.AddError("Facility should not be blank.");

                    retval = false;

              

              

            } return retval;

        }

    }

    public class SCRMSAfacilityValidatorFactory : XmlConfigValidatorFactoryBase

    {

        private static IValidatorFactory m_factory = new SCRMSAfacilityValidatorFactory();

        public static IValidatorFactory GetInstance() { return m_factory; }

        private SCRMSAfacilityValidatorFactory() { }

        protected override IValidator Create_Internal(XmlNode configNode)

        {

            return new SCRMSAfacilityValidator();

        }

    }

}

Comments

Post Details

Added on Dec 13 2019
3 comments
100 views