Attaching a URL to a navision page via SMTP Codeunit

Hi guys,

We are sending out an automated email via the SMTP mail. In a codeunit I create the email with production Order details, Is it possible via a code unit to get the bookmark for a certain page? I'm currently trying to use recordref.

For example I have I have the following code:

recProductionOrder.RESET;
recProductionOrder.SETRANGE("No.", recProdOrderLine."Prod. Order No.");
recProductionOrder.SETRANGE("Standard Cost Status", recProductionOrder."Standard Cost Status"::"Awaiting Cost");
IF recProductionOrder.FINDFIRST THEN BEGIN
ProdOrderRef.OPEN(DATABASE::"Production Order");
ProdOrderRef.SETPOSITION(ProdOrderRef.GETPOSITION);


I am later trying to get the bookmark for the page I found using the FINDFIRST above by using (ProdOrderRef.RECORDID,0,10). I've found this doesn't retrieve the same value as when you go "Copy Link to this page".

My question is it possible to get the correct url for a page from within a codeunit, if so how, and if not what's the alternatives?

Thnaks - We are using Navision 2013

Best Answer

  • LewisTioga
    LewisTioga Member Posts: 40
    Answer ✓
    The solution was:

    ProdOrderRef.OPEN(5405);
    ProdOrderRef.GETTABLE(recProductionOrder);
    ProdOrderRef.SETPOSITION(ProdOrderRef.GETPOSITION);

    And then for bookmark use FORMAT(ProdOrderRef.RECORDID,0,10);


Answers

  • Dolsha
    Dolsha Member Posts: 41
    Watch function "GETURL".
    1. Use ur setrange on rec;
    2. GETURL with parameters like
    Cust.Get(10000);
    url := GETURL(ClientType::Current, 'COMPANYNAME', ObjectType::Page, 21, Cust);
    
  • LewisTioga
    LewisTioga Member Posts: 40
    Thank you but we don't have the GETURL Function on Navision 2013.
  • Dolsha
    Dolsha Member Posts: 41
    LewisTioga wrote: »
    Thank you but we don't have the GETURL Function on Navision 2013.

    I thought u use 2013R2.
  • LewisTioga
    LewisTioga Member Posts: 40
    Answer ✓
    The solution was:

    ProdOrderRef.OPEN(5405);
    ProdOrderRef.GETTABLE(recProductionOrder);
    ProdOrderRef.SETPOSITION(ProdOrderRef.GETPOSITION);

    And then for bookmark use FORMAT(ProdOrderRef.RECORDID,0,10);