cancel
Showing results for 
Search instead for 
Did you mean: 

Default values in the Event-AfterModify

Former Member
0 Kudos

Hi Expert,

I have 2 questions here.

1) I wanted to set the default values to some of the fields, eg, valid from, to, created by, created at etc, as in the following screen shot. The codes are in the AfterModify. However, the default values will only be appeared after i clicked on the Next button, and not when it first appeared. At the same time, i cant set the default values in the AfterLoading.

2) I wanted to display the Territory name in the field after user selected the Territory in the OVS (screen shot below). I cant seems to get it right with the coding. I suspect the BO "SalesTerritory" may be wrong. Any idea?

\

Thanks in advance.

cheers,

julius

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Julius,

I assume, this is a custom BO with a custom GAF, correct?

Regarding 1 - Initialisation of fields:

If AfterModify is not working for you, I would alternatively suggest to create a custom action "Initialize" and call it via event handler (BOAction) from the ui after the BO has been created by the BOOperation

Regarding 2 - display of territory names

Since this is probably C4C and I do ByDesign, I can't give you a definite answer.

However:

How do you access the territory name in the datamodel of the floorplan?

On the association to the SalesTerritory, you might need to set the loading Type from "Lazy" to "standard" in the UI-Designer.

Best regards,

Ludger

--

Custom Development with All4Cloud.de

Former Member
0 Kudos

Hi Ludger,

Thanks Ludger, question 1 is solved by creating the custom action and called by a BOAction which is preceded by the BOOperation create.

For the question 2, the territory is an OVS field from the public OVS, as below. I'm not sure the loading type is the problem because from the debugging, there is no return from the query. Therefore i'm not sure BO SalesTerritory is the correct BO.

cheers,

julius

Answers (1)

Answers (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Julius,

You can default fixed values in the BO code.

E.g.:

element MyID : ID = "Hugo";

element MyCode : MyCode = MyCode.C0_SOME_CONSTANT;

element MyName : Name = {languageCode = "EN" };

HTH,

     Horst

Former Member
0 Kudos

Hi Horst,

Thanks for the reply.

Perhaps my first question is confusing

I have no problem to code the default values for Valid from, Valid to, created by, created date and created time, as in the screen shot below.

The problem is the timing when the system set the default values. In the first step of the GAF, there is no default values set to the screen (screen in my first thread).

After the user click "next" button to the step 2 and back (clicked previous button), the default values are filled automatically by the system. I suspected that the AfterModify is triggered after "next" button is clicked. Any workaround?

cheers,

julius

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Julius,

My example code is BODL, not ABSL.

As the "AfterModify" - as the name goes - is called after the UI was called it is too late for you.

Whereas the BODL values are part of the "Create" of the node instance.

Bye,

   Horst

Former Member
0 Kudos

Hi Horst,

That's interesting approach.

How to retrieve values, eg, current date, user, etc in the BODL?

Anyway, do you know the answer to question 2?

cheers,

julius

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Julius,

As I wrote in my first reply: This works only for fixed values, not for dynamic ones like "today".

Reg. question 2:

  • If you take "Baden-Württemberg" you should map it to the query parameter "Name"
  • If you take "9" you should map it to the query parameter "ID"

HTH,

     Horst