This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Action on activity2 item :

fli - Thursday, May 19, 2011 8:24 AM:

Hi members of the forum,
Please help me achieve following functionality:
When in the InBasket or in the Project Plan tab, I would like an action for the Activity2, opening a new form, on the form I would like a button “running” a method which creates an excel file with information from the activity2 Item. I have gotten this far.  
Action Method: Show the form.
var ActivityDelete = " _ActivityDelete ";
      var prFormNd = aras.getItem("Form", "name='" + ActivityDelete + "'", "<name>" + ActivityDelete + "</name>", 0);
      var prFormID = (prFormNd) ? prFormNd.getAttribute("id") : "";
      if (!prFormID)
      {
        aras.AlertError(top.aras.getResource("project", "add_project_dialog.form_not_found", ProjectOnAdd_FormNm));
        return;
      }
      prFormNd = aras.getFormForDisplay(prFormID);
      if (!prFormNd)
      {
        aras.AlertError(top.aras.getResource("project", "add_project_dialog.form_not_found_for_display", ActivityDelete));
        return;
      }
      prFormNd = prFormNd.node;
      aras.uiShowItemInFrameEx(document.frames["instance"], item, "edit", 0, prFormNd);
 
Form botton Event: Here I need to acces the Activity2 Item, “document.thisItem.” gives me the Project Item.
var excel = new ActiveXObject("Excel.Application");
excel.Visible=true;
var workbook=excel.Workbooks.add();
var sheet=workbook.ActiveSheet;
sheet.Cells(1,2).Value = "kat";
workbook.SaveAs("C:\Temp\IndMeld.xlsx");
I also tried this.
Opening the Activity2 Item for editing then changing the form.
I fail to change the form ?
Action method:
top.aras.uiShowItemEx(this.node, undefined,true);
var ProjectOnAdd_FormNm = "man_ActivityDelete_projectOnAdd";
      var prFormNd = aras.getItem("Form", "name='" + ProjectOnAdd_FormNm + "'", "<name>" + ProjectOnAdd_FormNm + "</name>", 0);
      var prFormID = (prFormNd) ? prFormNd.getAttribute("id") : "";
      if (!prFormID)
      {
        aras.AlertError(top.aras.getResource("project", "add_project_dialog.form_not_found", ProjectOnAdd_FormNm));
        return;
      }
      prFormNd = aras.getFormForDisplay(prFormID);
      if (!prFormNd)
      {
        aras.AlertError(top.aras.getResource("project", "add_project_dialog.form_not_found_for_display", ProjectOnAdd_FormNm));
        return;
      }
BR / Christoffer