Request Page

Hello together,

My problem is that i have a new button on the Sales Quote Page “Create Project”, this button invokes a Report with a Request Page, on this Request page i want to type in the name of the Project. That works, but i want to preassign the field with the “No.” of the Quote and the name of the Customer.

My Question is how can I make it that the request page knows that it belongs to the current data set ?

My Code so far :

OnOpenPage()

//“Sales Header”.GET(“Sales Header”.“No.”);

“Sales Header”.SETRANGE(“Sales Header”.“No.”,“No.”);

“Sales Header”.FINDFIRST;

CASE “Sales Header”.“Document Type” OF

“Sales Header”.“Document Type”::Quote:

JobDescription := “Sales Header”.“No.” + ’ - ’ + “Sales Header”.“Sell-to Customer Name”;

“Sales Header”.“Document Type”::Order:

JobDescription := “Sales Header”.“No.” + ’ ’ + “Sales Header”.“Sell-to Customer Name”;

END;

I hope I have described it properly and you can help me :smiley:

Thanks for replies.

Moritz

By the sound of it and assuming the report does not belong to the sales header table you need to pass this data to the report before running. You can do this via function call you create in the report which you then call from the Sales Quote page.

So in this example, create a function call in the report called PassData with 2 feed fields quote number and customer name.Create globals for each and add in code to assign local feeds to globals. Then call the report function and pass the data and then call the report.

Hope this helps.

Neil

Hello Moritz,

Please check below:

  1. Create one function in report as setJobDescription(JobDescription), means setJobDescription with JobDescription as parameter.

  2. Call this function OnOpen of report & use it.

  3. On action of ‘Create Project’ of “Sales Quote” create reports local variable

e.g. RepSales Report ReportName.

  1. Also create JobDescription variable & pass value as you want,

  2. Then pass filters for run the report & before run the report call setJobDescription Function,

RepSales.setJobDescription(JobDescription);

RepSales.Run.

Then you’ll get your expected output.

Hello Pramod,

I did all these steps, but now the field is not preassigned, but nevertheless my Problem above is solved. Now I have a other Problem :frowning:

Here is my function in the Report :

Here I use it on the OnOpenPage() Trigger :

4150.Unbenannt.JPG

And that´s what I do in the Page :

1033.Unbenannt.JPG

What have i made wrong ?

Hi

Do you selected No In the Confirm Box Which initiates from Action Trigger…Create Project…[:P]

Hi Raja,

They confirm Box just says “Do you want to create a Project from the Offer?” .

Hello,

Please assign value to “JobDescription” in “Create Project” Action.

Like:

Case …Document Type.

And I think don’t need to write CASE Statement because in both case you done same. Just write:

JobDescription := “Sales Header”.“No.” + ’ - ’ + “Sales Header”.“Sell-to Customer Name”;

CLEAR(SalesHeadertoJob);

SalesHeadertoJob.setJobDescription(JobDescription);

SalesHeadertoJob.RUN;

Create global variable JobDescription1 &

In “setJobDescription” function

setJobDescription(JobDescription:Text)

JobDescription1 := JobDescription;

And use “JobDescription1” to meet your requirement.

Hello,

Now it shows an empty field. I´m gonna show you what I have done.

In the “Create project” On Action Trigger :

Now we are in my Request page :

7522.nav2016.JPG

In the Code of the Request Page is my function :

3323.Unbenannt.JPG

And on the OnOpenPage Trigger i run the function. What did i made now wrong ? :frowning:

Thanks for your help :slight_smile:

Hello,

All are correct, but something wrong in report.

  1. Don’t call “setJobDescription” function in “OnOpen” trigger & remove global variable “JobDescription”.

And check it will work. [:)]

Hello,

It doesn´t work [:’(]…it just shows " - " and not the No. and the Customer Name… i think the request Page doesn´t know that it belongs to the current dataset ?

Hello,

Last change:

Please Check “Create Project” action

JobDescription := “No.” + ’ - ’ + “Sell-to Customer Name”;

Remove SalesHeader & check.

Thanks Pramod for your time you spent with my Problem , have a nice day. [H] [Y]

HI Moritz,

What i understood is you want to get run report from page action and the field in request page must be pre assigned …

i think want went wrong with your code is … its not finding the quote or order in setdescription function…

So can you try to change the code as follows

Crreate Project - OnAction()

IF GUIALLOWED THEN

IF NOT CONFIRM(Text001,TRUE) THEN

EXIT

ELSE BEGIN

JobDescription := Rec.“No.”; // jobdescrip… is code datatype

DugMoritztest.SetJobDescription(JobDescription); // dugmoritz is report local variable in action trigger.

DugMoritztest.RUN;

END;

SetJobDescription(SalesNo : Code[10])

SalesHeader1.RESET;

SalesHeader1.SETRANGE(SalesHeader1.“No.”,SalesNo); // salesheader1 is local var in function

IF SalesHeader1.FINDSET THEN BEGIN

jobdescriptiopn := FORMAT(SalesHeader1.“No.”) + SalesHeader1.“Sell-to Customer Name”;

END;

i think there is no need for code on onopenpage in request as you already called report it initialises it…

Let me know if it helped or Not…[Y]

Thanks Raja for the replie…i didn´t test it out cause the other solution works :smiley:

Thanks for your time [Y]

Can I write my Global Variable Value into to an field in the Table “Job” ?

Problem :

I have an Codeunit which inserts a new Project and it also insert the given Fields in the Sales Quote/Order, but how can i manage that the value of the Field "Project Description "in the Request Page fills the Field Job.Description in the Codeunit .

My Codeunit :

Hope you understand my problem [:D]

Thanks for Replies

Hi Moritz,

What is Link Between Codeunit and Report …how those interact with each other…

If you want job description from Report then Create a Global Funtion in Codeunit. which takes 2 parameter 1st is Sales Header nO and Other is jobdescription …

So when you call codeunit from report you would Pass them as Parameter So directly you can get jobdescription…

No Setrange for your sales No or whatever you want insert those values to Destined fields …

If you need any help let us Know…

Hi Mortiz,

Please pass that global variable to that codeunit.

Thank You

Mahesh U

Hello,

Thanks for the replies.

So i added a new global function “getJobDescription” With Paramters “SalesHeaderNo” and “JobDescription” :

7651.nav2016.JPG

My Report look now like this

Sales Header - OnAfterGetRecord()

MakeJobfromSalesHeader.getJobDescription("No."JobDescirption1);

MakeJobfromSalesHeader.RUN(Rec);

COMMIT;

What have I made wrong ?

Sorry buts its my first time using/programming a Codeunit. [8o|]

Ok wrong DataType on my Parameter :smiley:

But what must I write in my Function ?