hope u can help me. … So my Problem is that I have an Codeunit which Makes an (Order/Quote) to a Project, that works, but i want to Transfer the Sales Line into an JobTask and Later into the JobPlanning line, but first I want to create the JobTasks
for Example :
I have an Order/Quote which has an Ressource and some Items in its Lines and i want to convert the Order/quote into the Project, so the codeunit must Transfer these Lines at first into JobTask and later into JobPlanningLines
I don’t know why are doing it. I would still suggest if want to have a hardcoded value then use some fields in setup for same.
Now about your issue -
Start with line no 04 of Function (image 1) & do it in rest of function -
Replace SalesLine with SourceSalesLine in Your Image1.
Why are you passing jobtask as a Var of TransferSalesLinesToProjectPlanLine Function when you are using it in that function. Either Remove it or Use it in the Function insted of Job Task.
Hello Moritz,
Can you set Like SourceSalesLine.SETRANGE(“Document Type”,SourceSalesLine.“Document Type”::Order);
and see for results. i think it is not able to find any set, hope it will solve your problem…
Hi,
First -
Pass the whole Primary key for sales header as - Document Type(DocType) and Document No.(DocNo), as you can have Sales Order and Sales Invoice with Same No.
Then in Function get the SalesHeader, using SalesHeader.GET(DocType,DocNo);
The Problem in the code still is
Third & Fourth Line Should be -
SalesLine.SETRANGE(“Document Type”,Sales Header".“Document Type”);
SalesLine.SETRANGE(“Document No.”,Sales Header".“No.”);
SalesHeader.SETRANGE(“No.”,SalesHeaderNo);
IF SalesHeader.FINDFIRST THEN BEGIN //Add this
SalesLine.SETRANGE(“Document No.”,SalesHeaderNo); Here both are correct SalesHeaderNo or SalesHeader.“No.”
Remove this line
SalesLine.SETRANGE(“Document Type”,“SalesLine…Document Type”); //This code has no Impact Or else pass some Document type if It’s for Order/Invoice or anything.
[mention:716a4eabc27e405f9eb3919568dacf92:e9ed411860ed4f2ba0265705b8793d05] yes, regret that I some troubles with the database yesterday, so it was down 2-3 hours. But it’s up and runs faster than before.
Yes, you are right that report and codeunits doesn’t know the job no.
there is a field Job No. in sales line table, are you filling this field or not?
or you can add a job no. field in request page of report and based on the input you can pass it to codeunit
No i dont´t fill Job No. in the Sales Line Table and i tried youre other solution but its not working
My Suggestion is :
In my other fuction where i fill the Job “Header” there i say that Job.No = 0 , but he don´t write the 0 rather he writes the ongoing project number but why ?
can i copy this value and write to the Job No. in the Job task table ?
So you are creating Job based on Sales Header information and you want to use same Job no. while creating tasks?
Where is this getjobdescription called?
if Job no. field is available in the sales header table then add the newly created job no. to sales header job no. field.
PS: please set filter on document type also while trying to find Sales Header.
Use Get function.
If all you need is to know which Job No. was created by the function, but just needs to know this in the object you are calling the function from, then you could just add it as a return value.
Then you would change this line: Job.INSERT(TRUE); to IF Job.INSERT(TRUE) THEN EXIT(Job.“no.”); and it would return the job no. created.