cancel
Showing results for 
Search instead for 
Did you mean: 

CRM - Time Rule - Date and duration difference in XML

om_awasthi1
Participant
0 Kudos

Hi All,


Please provide your input on the below query .

Objective

To create a date rule in CRM system, the date rule is created using XML . The date  should be output of date - duration , omitting the weekends ( saturday and sunday ) .

Input

The input is  date ( lets says - 25.07.2014) and duration is 5 days . The output should be the input date - duration ,if there is any weekend which is falling between the input date and duration ,it will not count the weekend as number of days and provide the result .

Please find the example ,In the below code

VarTimeExp = 25.07.2014

ConstDuraExp = 5days

VarTimeExp will contain the output/result =  Date provided in the ZRC04_01 - Duration of 5 days in ConstDuraExp.

Result = 20.07.2014 . It is considering the weekends in counting number of days

Expected result - 18.07.2014, should not consider the weekends


Note -  The factory calendar is already set and badi is implemented

Case 1

<?xml version="1.0"?>

<TimeRule>

   <TimeRuleSource>

      <ruleline>

         <AssignTimeExp displaytype="AssignTime">

            <VarTimeExp displayType="VarTime"  name="RESULT"   position='B'>

              <VarObjectExp displaytype="VarObject"  name="ZXXX001"/>

            </VarTimeExp>

            <MoveTimeExp displaytype="MoveTime" direction="-">

               <VarTimeExp displayType="VarTime"  name="ZRC04_01"  position="B">

                <VarObjectExp displaytype="VarObject"   name="ZXXX001"/>

               </VarTimeExp>

               <VarDuraExp displaytype="VarDura"  name="ZRC04_D4" timeunit="DAY">

                  <VarObjectExp displaytype="VarObject"   name="ZXXX001"/>

               </VarDuraExp>

            </MoveTimeExp>

         </AssignTimeExp>

      </ruleline>

   </TimeRuleSource>

</TimeRule>

but when i implement the Case 1  code i am not getting the desire result . Please find the screen shot .

Please provide your input on the above scenario and do let me know if you need more information from my end .

Thanks

OM

Accepted Solutions (1)

Accepted Solutions (1)

om_awasthi1
Participant
0 Kudos

Hi All,

The issue is resolved .The above rule will work perfectly fine , only we have to provide the missing configration in the system . Please find the same below

              

Also if you want to have constant duration then the above configration is also not required the rule will work without the above configration . Please find the rule written - when you have constant duration .

<?xml version="1.0"?>

<TimeRule>

   <TimeRuleSource>

      <ruleline>

         <AssignTimeExp displaytype="AssignTime">

            <VarTimeExp displayType="VarTime"

                               name="RESULT"

                           position='B'>

              <VarObjectExp displaytype="VarObject"

                                name="ZXXX001"/>

            </VarTimeExp>

            <MoveTimeExp displaytype="MoveTime" direction="-">

               <VarTimeExp displayType="VarTime"

                                  name="ZRC04_01"

                                  position="B">

                 <VarObjectExp displaytype="VarObject"

                                name="ZXXX001"/>

               </VarTimeExp>

               <ConstDuraExp displaytype="ConstDura"

                                duration="5" timeunit="DAY">

                  <VarObjectExp displaytype="VarObject"

                                name="ZXXX001"/>

               </ConstDuraExp>

            </MoveTimeExp>

         </AssignTimeExp>

      </ruleline>

   </TimeRuleSource>

</TimeRule>

Thanks,

OM

Answers (0)