Dear sirs, from Management of relations/Contacts you can create a contact like client from Action/To create like client. What I want is that when trying it verifies it if a certain interaction has been carried out looking for this in the table " Interaction Log Entry" and I put the following code:
interaccion.INIT;
IF interaccion.GET (Cont." No.") THEN;
IF interaccion." Interaction Template Code" =' 3'
THEN CreateCustomer (ChooseCustomerTemplate) ELSE ERROR: ='must send interaction 3';
interaction is the table Interaction Log Entry
Cont is the table Contact
All good, but when trying it appears to me the message " The type of the Code expression cannot become to a value Integer" and it does not let to me continue. I suppose that is because the first key from Interaction Log Entry table is a Integer one and "No." it's a Code one. How can I do it?.
Thanks in advance.
0
Comments
interaccion.INIT;
If not (Evaluate(ContactNo,Cont." No.")) then
error('Could not convert into Integer');
IF interaccion.GET (ContactNo) THEN;
IF interaccion." Interaction Template Code" =' 3'
THEN CreateCustomer (ChooseCustomerTemplate) ELSE ERROR: ='must send interaction 3';
I hope it helps.... O:)
Technical Consultant, MS Dynamics NAV
Thanks.
You are searching for the contact no in the Interaction log entry.
so I would suggest something like....
I hope it helps.... O:)
Technical Consultant, MS Dynamics NAV
"Show All..."
"Oh..."
interaccion.INIT;
interaccion.Reset;
interaccion.SetCurrentKey("Contact No.","Correspondence Type","E-Mail Logged",Subject,Postponed);
IF interaccion.GET (Cont." No.") THEN;
IF interaccion." Interaction Template Code" =' 3'
THEN CreateCustomer (ChooseCustomerTemplate) ELSE ERROR: ='must send interaction 3';
Technical Consultant, MS Dynamics NAV
In the 5.0 Version It is a field and part of the key.
Just comment the SetCurrentKey Part and then check if it works the same what you want. Later correct key can be set.... O:)
Technical Consultant, MS Dynamics NAV
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
IF interaccion.GET (Cont."No.") THEN;
IF interaccion."Interaction Template Code" = '3' THEN
CreateCustomer (ChooseCustomerTemplate)
ELSE
ERROR:='must send interaction 3';
Ant idea else please; thanks you very much for your interest.
The problem is with [IF interaccion.GET (Cont."No.") THEN; ] because Get works with primary key only...!!
Technical Consultant, MS Dynamics NAV
Thanks for everything.
http://www.BiloBeauty.com
http://www.autismspeaks.org
a semicolon ....!!
interaccion.SetRange("Contact No.",Cont."No.") ;
Technical Consultant, MS Dynamics NAV
NO, that is OK. Ideally that should be there for better readability.
Technical Consultant, MS Dynamics NAV
I'm sorry, I believe that I am bothering too much......
I did following for the test
it is working for me....!!
Technical Consultant, MS Dynamics NAV
Technical Consultant, MS Dynamics NAV
http://www.BiloBeauty.com
http://www.autismspeaks.org
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks everybody for help.
Thanks in advance.
FINDFIRST will only work from 4.0 SP3 and up, if you are using earlier then use FIND('-') instead of FINDFIRST
-a
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
IF interaccion.FIND('-') THEN BEGIN
IF interaccion."Interaction Template Code" = '3' THEN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR('must send interaction 3');
END;
Thanks.
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
IF interaccion.FIND('-') THEN BEGIN
IF interaccion."Interaction Template Code" = '3' THEN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR(interaccion."Interaction Template Code");
END;
It will show you the template code for the selected record, then you can see maybe the problem.
I may also in your error message show the primary key fields (not sure myself whatthey are for this table), maybe you are not on the record you expect.
-a
Thank you very much for help.
Try this - run the table, and choose the same key as is in your code and then apply the same filter as on the code.
What record is first? I suspect the same incorrect one that you do not want to see. If you change the key to something else do you see the record you want? Or maybe your record is the last one in the list instead of the first?
-a
In this case the interaction it's done, but the code go on show me the message "must send interaction 3", the record is the last one on the list; then it proves that don't check the table correctly looking for coincident values. I've check several keys and it shows me differents interactions, not what I want.
Thanks.
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
interaccion.SETRANGE("Interaction No.",'3'); //<- not sure of this
IF NOT interaccion.FIND('-') THEN
ERROR(interaccion."Interaction Template Code")
ELSE
CreateCustomer(ChooseCustomerTemplate);
You probably need to use a better key, it should be Contact No., Interaction No..
-a
Also I've created the key, Contact No., Interaction Template Code, but the result it's the same. It's strange, i don't know what I do.
Thank you very much for your interest.