SPItemEventReceiver ItemAdded running twice

I have searched the web to find a way to start workflows on items created by anonymous users. The consensus seems to be to create an event receiver fired on the ItemAdded event. I have managed to get my code to cancel the workflow created by the anonymous
user and then start the workflow as the system admin. I do this with a
RunWithElevatedPrivileges section.
I noticed when debugging that for some reason the code inside the ItemAdded event runs twice. This was having the effect of creating two instances of the workflow when I was starting the workflow synchronously. When I changed it to Asynchronous it creates
an instance and then throws an exception when trying to create a second instance. So at least this gives me my desired effect of just having one instance of workflow started. But I would like to know why it fires twice and how I can stop it.
site.WorkflowManager.StartWorkflow(item, wf, string.Empty, SPWorkflowRunOptions.Asynchronous);
Any ideas/help greatly appreciated.

Hi,
Theoretically it's not possible to create the same list item twice. Can you check the list item id? Are their IDs same for first and second ItemAdded event? Also does the workflow creates another list item, which might cause to fire Item Add event again?
Are you trying to run SharePoint 2013 workflow or SharePoint 2010? As I know you can't use RunWithElevatedPrivileges to run SharePoint 2013 workflow. You need a valid user (not system) account. Possibly you can try to use 'app step' as described at
http://msdn.microsoft.com/en-us/library/office/jj822159(v=office.15).aspx. As described in he link:
You need to create an app-level permission (full control)
wrap your code block in 'app step' which will use 'full control' permission irrespective of current logged in user
And it'll work win non-app sites (as long as you have app service application configured)
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com

Similar Messages

  • Stored Proc running twice using DBMS_Scheduler

    Hello all,
    I have a vb front end that calls a main stored proc which submits scheduler jobs to execute several stored procs asynchronously. Everything is working, except the part that the several stored procs are running twice. In the troubleshooting, I have eliminated the front end from being the culprit and the stored procs themselves. Essentially, when I call the stored proc using dbms_scheduler.create_job, it runs twice, even manually. I am about at wits end trying to figure out why: Using Oracle 11gR2
    I started off setting up the programs
    begin
    --create program
    dbms_scheduler.create_program
    ( program_name => 'prog_name'
    ,program_type => 'STORED_PROCEDURE'
    ,program_action => 'usp_sub_proc_1'
    ,number_of_arguments => 8
    ,enabled => FALSE
    dbms_scheduler.DEFINE_PROGRAM_ARGUMENT
    ( program_name=> 'prog_name'
    ,argument_position=>1
    ,argument_name => 'name'
    ,argument_type=>'VARCHAR2'
    /*the remaining 7 arguments are in code but not display for space reasons*/
    dbms_scheduler.enable('prog_name');
    end;Then the main stored proc executes this code:
    declare v_job_name varchar2(100);
        v_1 varchar(50) := 'All';
        v_2 varchar(50) := 'All';
        v_3 varchar(50) := 'All';
        v_4 varchar(50) := 'All';
        v_5 varchar(50) := 'TEST';
        i_6 integer := 1;
        v_7 varchar(50) := 'TEST_NE';
        ts_8 timestamp := current_timestamp;
    begin
        v_job_name := 'uj_dmo_1';
    dbms_scheduler.create_job (v_job_name
                                            ,program_name => 'prog_name'
                                            ,job_class => 'UCLASS_1'
                                            ,auto_drop => TRUE
    --set parameters
    dbms_scheduler.set_job_argument_value(v_job_name,1, v_1);
    dbms_scheduler.set_job_argument_value(v_job_name,2, v_2);
    dbms_scheduler.set_job_argument_value(v_job_name,3, v_3);
    dbms_scheduler.set_job_argument_value(v_job_name,4, v_4);
    dbms_scheduler.set_job_argument_value(v_job_name,5, v_5);
    dbms_scheduler.set_job_argument_value(v_job_name,6, to_char(i_6));
    dbms_scheduler.set_job_argument_value(v_job_name,7, v_7);
    dbms_scheduler.set_job_argument_value(v_job_name ,8, to_char(ts_8));
    --enable job
    dbms_scheduler.enable(v_job_name);
    --execute job
    dbms_scheduler.run_job(job_name => v_job_name , use_current_session => FALSE);
    end;
    ...And this is where I get the double execution of the job, but I am just not seeing it in my syntax, dba_scheduler_jobs, logging, etc. Any help is greatly appreciated, thanks!!

    Well apparently I will not win any Captain Obvious awards;
    With 34MCA2K2's response with "what doesn't work" for some reason turned the light on. After some more testing here is what I found.
    This code works as expected :
    Exhibit A
    begin
    dbms_scheduler.create_job (job_name =>'TESTER'
                                   ,job_type => 'PLSQL_BLOCK'
                                   ,job_action => 'declare test1 integer := 1; begin test1 := test1 + 5; end;'
                                   ,auto_drop => True
       /*dbms_scheduler.enable('TESTER');   */
       dbms_scheduler.run_job(job_name => 'TESTER', use_current_session =>FALSE);   
    end;As does this:
    Exhibit B
    begin
    dbms_scheduler.create_job (job_name =>'TESTER'
                                   ,job_type => 'PLSQL_BLOCK'
                                   ,job_action => 'declare test1 integer := 1; begin test1 := test1 + 5; end;'
                                   ,auto_drop => True
       dbms_scheduler.enable('TESTER');  
      /*dbms_scheduler.run_job(job_name => 'TESTER', use_current_session =>FALSE);    */
    end;Exhibit A will create the job and is visible in the schedulerjobs view, and the RUN_JOB will execute it even when not enabled, but the pl/sql will not drop the job.
    Exhibit B will create the job and once enabled, executes the job and then drops from schedulerjobs view.
    Therefore, my desired results for running the jobs once asynchronously and dropping immediately is....
    begin
        v_job_name := 'uj_dmo_1';
    dbms_scheduler.create_job (v_job_name
                                            ,program_name => 'prog_name'
                                            ,job_class => 'UCLASS_1'
                                            ,auto_drop => TRUE
    --set parameters
    dbms_scheduler.set_job_argument_value(v_job_name,1, v_1);
    dbms_scheduler.set_job_argument_value(v_job_name,2, v_2);
    dbms_scheduler.set_job_argument_value(v_job_name,3, v_3);
    dbms_scheduler.set_job_argument_value(v_job_name,4, v_4);
    dbms_scheduler.set_job_argument_value(v_job_name,5, v_5);
    dbms_scheduler.set_job_argument_value(v_job_name,6, to_char(i_6));
    dbms_scheduler.set_job_argument_value(v_job_name,7, v_7);
    dbms_scheduler.set_job_argument_value(v_job_name ,8, to_char(ts_8));
    /*enable job*/
    dbms_scheduler.enable(v_job_name);
    /*execute job (Do not execute the code below, it will lead to multiple executions)
    dbms_scheduler.run_job(job_name => v_job_name , use_current_session => FALSE); */
    end;

  • I have a php module which runs fine in Firefox and all other browsers but not Safari. It always run twice - I see a small ? in upper right corner which is causing it to run twice but NO idea why? Help - thank you

    I have a php module which runs fine in Firefox and all other browsers but not Safari. It always run twice - I see a small ? in upper right corner which is causing it to run twice but NO idea why? I read it MAY have something to do with am image it cannot load but I see them all loaded.  Help - thank you

    Could you share a link to the page?
    Seeing it in context and in our browsers is much easier to debug.
    If not, make sure to run the validator here The W3C Markup Validation Service and clear out any problems. HTML errors, especially structural ones, will cause all kinds of display problems in various browsers/versions/platforms.

  • How to schedule a job to run twice within a request set?

    How to schedule a job to run twice within a request set?

    Create one more stage for the same concurrent program.
    Thanks
    Nagamohan

  • DBMS scheduler jobs running twice

    Hi,
    I have 4 DBMS scheduler jobs , which checks for a specific job status in DB and sends an email , when i started the schedule for the first week the jobs executed fine from next week I am getting two emails from each job , when i check the logs USER_SCHEDULER_JOB_RUN_DETAILS I see only one run , which seems weird to me so i disabled one job and left the three jobs in schedule , next time i got two emails from 3 jobs and one from disabled job . After checking logs i see that there is no entry of the disabled job execution . I am not sure where is the problem i can't find any log from where the disabled job executing. Please help me
    Job schedule is to run every Saturday
    Interval setup :
    start_date => trunc(SYSDATE)+ 8.5/24,
    repeat_interval => 'TRUNC(LEAST(NEXT_DAY(SYSDATE,''SATURDAY'') )) + 8.5/24'
    Suresh

    Hi,
    I tried to schedule the same jobs using DBMS_JOB but i still get the same problem , I created the procedure with all code in and scheduled it using dbms job , first day it run once second day it run twice ( sending two emails) Inow i am not sure if issue is with my code or scheduler
    Procedure
    Declare
    v_count number;
    v_Recipient VARCHAR2(400) := '[email protected]';
    v_Subject VARCHAR2(80) := 'TEST_Email';
    v_Mail_Host VARCHAR2(30) := 'localhost';
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    BEGIN
    select count(*) into v_count from TEC_CODERETURN@RPRD where interface like 'FOR002B' and trunc(rundate) =trunc(sysdate);
    if v_count = 0
    then
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Rcpt(v_Mail_Conn, '[email protected]');
    UTL_SMTP.OPEN_DATA(v_Mail_Conn);
    utl_smtp.WRITE_RAW_DATA(v_Mail_Conn, UTL_RAW.CAST_TO_RAW(
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || UTL_TCP.CRLF ||
    'From: ' || '[email protected]' || UTL_TCP.CRLF ||
    'Subject: '|| v_Subject || UTL_TCP.CRLF ||
    'To: ' || v_Recipient || UTL_TCP.CRLF ||
    'This is a test Alert'|| UTL_TCP.CRLF
    UTL_SMTP.CLOSE_DATA(v_mail_conn);
    utl_smtp.Quit(v_mail_conn);
    end if;
    EXCEPTION
    WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
    raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    DBMS job creation
    DECLARE
    jobno NUMBER;
    BEGIN
    DBMS_JOB.submit
    (job => jobno,
    what => 'TEST_ALERT;',
    next_date => trunc(sysdate)+0.1/24,
    interval => 'SYSDATE + 1',
    no_parse => TRUE );
    DBMS_OUTPUT.put_line ('Created Job - the job number is:' || TO_CHAR (jobno));
    COMMIT;
    END;
    Suresh

  • Why the process chain always run twice when triggered from R3?

    I run a program from R3 by calling the remote function 'RSSM_EVENT_RAISE' on BW to trigger an event and in turn the event on BW bring up the running of a process chain.  But whenever I run the program on R3 to bring up the running of the process chain, I find the process chain always run twice at the same time.  Does anybody knows the answer? 
    And also I would like to know the functionalities of the two picture buttons "Activate" and "Activate and Schedule" in process chain.  In which case the "Activate" button should be used and in which case, the "Activate and Schedule" button should be used?   If we click the Start variant of a process chain, then click "Change Selections" button which bring up the window "Start Time" where the buttons "Immediate", "Date/Time", "After job", and "After event" are listed at the top.  If we modify at any of the above buttons, then after save this modification, we will have to click "Activate and Schedule" button to make it work, right? 
    Thanks a lot and everyone's idea is greatly appreciated!

    Kevin, make sure there is only one job scehduled for the Start Process of your Process Chain.  If you bring up the Process Chain (not the log view), right click on the Start Process and select "Displaying Scheduled Job(s)...".  There should only be one scheduled job with name BI_PROCESS_TRIGGER.  If there is more than one, then when triggered, it would execute more than once at the same time.  If there is only one job, then maybe your R/3 program is triggering the event more than once? 
    As far as the Start conditions for the Start Process, it works off the same principals as a scheduled job.  These start conditions determine when or how the Process Chain is to be executed.  You also have control over frequency.  These start conditions determine the scheduling of the Start Process of your Process Chain.
    When you schedule a Process Chain, a separate scheduled job is created for "each" process in the Chain.  BW controls the triggering of these jobs based upon how the processes in the Chain are linked.  All the jobs associated with Process Chains have strict naming conventions and all begin with BI_PROCESS_...  If you use SM37 to view all jobs that begin with BI_PROCESS_ you will find alot of scheduled jobs associated with your process chains.  Each job represents one of the processes within your process chains. 
    Does this help?
    Another tip might be to trigger the event manually in BW (use tx SM64).  If the process chain executes twice again, then maybe there is a separate scheduled job in BW that triggers the process chain that is triggered by the same event as the start process of the process chain.
    Message was edited by: George Shannon

  • Portlet controller beeing run twice

    Hello,
    I noticed a small issue regarding some of my portlets, their controller are run twice for some reason. What can I do to prevent this?
    Running SpringFramework on Bea Weblogic portal 8.1

    Hi Tmukunne,
    I'm confused why you ran the cmdlet "Install-ADDSForest" twice, after you install ADDS role and configure DC with the cmdlet "Install-ADDSForest", you can reboot the server and Domain Controller should work now:
    Install-WindowsFeature -Name AD-Domain-Services
    $Password = ConvertTo-SecureString -AsPlainText -String Password0! -Force
    Install-ADDSForest -DomainName Corp.contoso.com -SafeModeAdministratorPassword $Password `
    -DomainNetbiosName contoso -DomainMode Win2012R2 -ForestMode Win2012R2 -DatabasePath "%SYSTEMROOT%\NTDS" `
    -LogPath "%SYSTEMROOT%\NTDS" -SysvolPath "%SYSTEMROOT%\SYSVOL" -NoRebootOnCompletion -InstallDns -Force
    Restart-Computer -Force
    And you can also run the cmd "dcdiag" to analyze the state of the domain controller, and check if there is any error or failure.
    If there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,                                 
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • DocClose event runs twice after extending with user rights

    I have created a form with several fields. To check if the fields are filled, I have placed several checks if the DocClose event. This creates a messagebox containing text of the missing fields. This will only popup when the pdf is closed. See below for a part of the Java-script.
    var errmsg = ""
    if (Form.Page1.CompanyName.rawValue == null)
    {errmsg = errmsg + "CompanyName is not filled in";}
    if (Form.Page1.CompanyStreet.rawValue == null)
    {errmsg = errmsg + "\n";
    errmsg = errmsg + "CompanyStreet is not filled in";}
    if (errmsg !== "")
    {xfa.host.messagebox (errmsg, "Please note!",1,0);}
    else
    This works just fine in Adobe Acrobat and in Adobe Reader. However,the user needs to be able to save a local copy. So, I use Adobe Acrobat 9 Standard to "Extend Forms Fill-In & Save in Adobe Reader". After this change, when this PDF is opened in the Reader or in Acrobat, the messagebox runs twice! The first time as it should, but the second time, it
    I also noticed that the Script language of this part has changed from Java to mixed.
    Thanks for any help!
    Erik

    Dear all,
    I have the same problem, do you have any solution for this?
    Best regards
    Fernando

  • Why does this AppleScript run twice in Automator?

    I am trying to create an application that I can run and change the function of my F1, F2 keys to or from standard function. I found this AppleScript online and it works... but it runs twice in a row:
    tell application "System Preferences" to activate
    tell application "System Events"
    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.keyboard"
    end tell
    tell process "System Preferences"
    click radio button "Keyboard" of tab group 1 of window "Keyboard"
    get every attribute of checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard"
    click checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard"
    activate
    if value of checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard" = 0 then
    display dialog ¬
    "Standard Function Keys off..." giving up after 1
    else
    display dialog ¬
    "Standard Function Keys on..." giving up after 1
    end if
    end tell
    tell application "System Preferences"
    quit
    end tell
    end tell
    If I change the Script by taking out the following, it only runs once. I believe my issue is in the below Script. I have fiddled with all that I know how to and either it doesn't run, or it runs twice...
    tell process "System Preferences"
    click radio button "Keyboard" of tab group 1 of window "Keyboard"
    get every attribute of checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard"
    click checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard"
    activate
    if value of checkbox ¬
    "Use all F1, F2, etc. keys as standard function keys" of ¬
    tab group 1 of window "Keyboard" = 0 then
    display dialog ¬
    "Standard Function Keys off..." giving up after 1
    else
    display dialog ¬
    "Standard Function Keys on..." giving up after 1
    end if
    end tell
    Any suggestions would help. If you run it and it only runs once, I am at a loss. Thank you for you time.

    it works fine for me in both automator and applescript. are you sure you didn't enter it twice in the Run Applescript workflow?
    a couple of tweaks, more for clarity than anything else:
              tell application "System Preferences"
                        activate
                        set current pane to pane "com.apple.preference.keyboard"
              end tell
              tell application "System Events"
                        tell process "System Preferences"
                                  click radio button "Keyboard" of tab group 1 of window "Keyboard"
                                  get every attribute of checkbox ¬
                                            "Use all F1, F2, etc. keys as standard function keys" of ¬
                                            tab group 1 of window "Keyboard"
                                  click checkbox ¬
                                            "Use all F1, F2, etc. keys as standard function keys" of ¬
                                            tab group 1 of window "Keyboard"
                                  activate
                                  if value of checkbox ¬
                                            "Use all F1, F2, etc. keys as standard function keys" of ¬
                                            tab group 1 of window "Keyboard" = 0 then
                                            display dialog ¬
                                                      "Standard Function Keys off..." giving up after 1
                                  else
                                            display dialog ¬
                                                      "Standard Function Keys on..." giving up after 1
                                  end if
                        end tell
                        tell application "System Preferences"
                                  quit
                        end tell
              end tell

  • Constructor in document class runs twice?

    Hi Folks,
    I'm working on my document class and the contructor is running twice, hence it is running almost all of my code twice.  I'm not quite sure why this is the case.  Any help is appreciated.
    I've attached my code below.
    package {
    import flash.display.MovieClip;
    import flash.display.DisplayObject;
    import flash.events.*;
    import flash.geom.*;
    import flash.net.*;
    import flash.utils.getDefinitionByName;
    public class ASIFL048_DND extends MovieClip {
      private var startDragX:Number = new Number();
      private var startDragY:Number = new Number();
      private var xmlPath:String = "../ObjectFiles/xmlIFL0480016.xml";
      private var itemList:Array = new Array();
      private var targetList:Array = new Array();
      private var gameArray:Array = new Array();
      private var myXML:XML = new XML();
      private var myTargetName:String = new String();
      private var XMLLoader:URLLoader = new URLLoader();
      private var XMLRequest:URLRequest = new URLRequest(xmlPath);
      trace("RUNNING ONCE!");
      public function ASIFL048_DND() {
       stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
       stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
       XMLLoader.addEventListener(Event.COMPLETE, completeHandler);
       trace("RUNNING TWICE?");
       loadXML();
      private function loadXML():void {
       //var XMLLoader:URLLoader = new URLLoader();
       //var XMLRequest:URLRequest = new URLRequest(xmlPath);
       XMLLoader.load(XMLRequest);
       //XMLLoader.addEventListener(Event.COMPLETE, completeHandler);
      private function completeHandler(e:Event):void {
       myXML = XML(e.target.data);
       var i:int = 0;
       var j:int = 0;
       for each (var item:XML in myXML..equip) {
        itemList[i] = item.@name;
        for each (var target:XML in item..myTarget) {
         targetList[j] = [i,target];
         j++;
        i++;
       //trace(targetList);
       selectDragItems(10);
      private function selectDragItems(gameLength:int):void {
       var randomSeed:Number = new Number();
       var randomItem:Number = new Number();
       for (var k:int = 0; k<gameLength; k++) {
        randomSeed = targetList.length;
        randomItem = Math.floor(Math.random() * targetList.length);
        gameArray = targetList.splice(randomItem, 1);
        trace(gameArray+"\n");
        //display game array
        //trace("CLASS:\t"+itemList[gameArray[k][0][0]]);
             //var ClassReference:Class = getDefinitionByName(itemList[gameArray[k][0]]) as Class;
        //var instance:Object = new ClassReference();
        //addChild(DisplayObject(instance));
      private function mouseDownHandler(e:MouseEvent):void {
       startDragX = e.target.x;
       startDragY = e.target.y;
       trace(startDragX + " " + startDragY);
       e.target.startDrag(true,new Rectangle(e.target.width/2,e.target.height/2, stage.stageWidth-e.target.width, stage.stageHeight-e.target.height));
      private function mouseUpHandler(e:MouseEvent):void {
       stopDrag();
       myTargetName = "fwdLHWindscreen_mc";
       var myTarget:DisplayObject = getChildByName(myTargetName);
       //trace(" TARGET VAR: "+myTarget.name);
       if (e.target.dropTarget != null && e.target.dropTarget.parent == myTarget) {
        trace("correct");
        e.target.x = e.target.dropTarget.parent.x;
        e.target.y = e.target.dropTarget.parent.y;
        e.target.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
        e.target.removeEventListener(MouseEvent.MOUSE_UP,mouseUpHandler);
       } else {
        trace("incorrect");
        e.target.x = startDragX;
        e.target.y = startDragY;

    My bad. The order of output is:
    RUNNING ONCE!
    RUNNING TWICE?
    The first trace is a static initializer, while the second is in the constructor.

  • Why is adobe running twice?

    as you can see adobe is running twice? why??
    I have windows 7 32bit, latest version of firefox and adobe

    I have the same thing happening. Today my pc became noticeably slow (even logging into windows usually takes about 5 seconds, today it takes almost a min). I have ran virus and malware scans and found nothing. I checked processes to see if there is anything unusual and found nothing except this. And when I re-entered task manager both processes were gone.

  • Opening JPG from Bridge via ACR in PS causes ACR to run twice.

    Using PSCS3 and Bridge CS3, with both set to prefer ACR when opening JPG files. Sometimes when opening a file from within Bridge with PSCS3, ACR runs twice. The image can be opened in PS and then ACR opens again with another copy of the JPG. Cancelling the ACR window closes it.
    Anyone else get ACR running twice on the one JPG?
    Thanks.
    Stew.

    The most common reason for patch to fail is the absence of folder "AdobePatchFiles" folder or it's content from location "C:\Program Files (x86)\Adobe\Adobe\AdobePatchFiles" and it's counterpart location in Mac.
    If this folder or its contents are missing then the patch cannot be applied , the only way to resolve this is to Reinstall the product and then apply patch again.
    Now there can be two cases :
    1) Was this folder removed manually or some other action caused this removal of folder( May be some script or Defragmentation or anything). In this case please reinstall product and apply patch again.
    2) If the folder and its contents are intact but still patcher failed, then please follow the following steps:
         a) Create ribs3debug file without any extension inside %temp% directory of your system
         b) Run Patcher again
         c) If it fails , send the log files that are generated inside C:\Program Files (x86)\Common Files\Adobe\Installers
    Hope it clears some of the facts around failure. If there are any underlying issues then we all hope to resolve them as soon as we have more information.
    Regards
    Anshum

  • RE: insert statement runs twice in place of once Randomly

    Hi
    I am using a simple nsert statement .The insert statement picks a variable
    from the form and inserts it into the database
    I have no loops in the page
    the code is :
    <cfif isdefined("Form.Category")>
    <cfquery name="InsertCat" datasource="ShoppingCart">
    Insert Into ShoppingMstCategory(Category)
    Values '#Form.Category#')
    </cfquery>
    </cfif>
    The insert runs twice on its own.
    Though if I use Query analyser to insert the statement only inserts once.
    am I missing something. I am using CF 10

    ColdFusion is behaving exactly as it should. When the form is submitted, the variables form.category and form.categoryEdit are both defined. In other words, isdefined("Form.Category") and isdefined("Form.CategoryEdit") are both true. Hence, the if-block as well as the else-block will run.

  • Re: insert statement runs twice in place of once

    I am using a insert statement.The insert statement picks a variable
    from the form and inserts it into the database
    I have no loops in the page the code is :
    <cfif isdefined("Form.Category")>
    <cfquery name="InsertCat" datasource="ShoppingCart">
    Insert Into ShoppingMstCategory(Category)
    Values('#Form.Category#')
    </cfquery>
    </cfif>
    The insert runs twice on its own.
    Though if I use Query analyser to insert the statement only inserts once.
    am I missing something. I am using CF10.
    Here's the whole page.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>cat update</title>
    </head>
    <body>
    <cfif isdefined("Form.Category")>
    <cfquery name="InsertCat" datasource="ShoppingCart">
    Insert Into ShoppingMstCategory(Category)
    Values('#Form.Category#')
    </cfquery>
    <cfelse>
    <cfif isdefined("Form.CategoryEdit")>
    <cfquery datasource="Shoppingcart">
    UPDATE ShoppingMstCategory
    SET
    [Category] = '#Form.Category#'
    WHERE CategoryID = #Form.EditId#
    </cfquery>
    </cfif>
    </cfif>
    </body>
    </html>

    ColdFusion is behaving exactly as it should. When the form is submitted, the variables form.category and form.categoryEdit are both defined. In other words, isdefined("Form.Category") and isdefined("Form.CategoryEdit") are both true. Hence, the if-block as well as the else-block will run.

  • Scheduled Tasks Run Twice After Upgrade To MX7

    I've recently upgraded to CFMX7 and now my scheduled tasks
    are running twice. I've recreated all of the tasks, rebooted the
    server, and made sure that I'm on V 7.0.2 but nothing seems to
    help. Is there a solution for this out there?

    I've got a couple ideas. I haven't seen this before but this
    should be some stuff to try. There's a file in the ColdFusion lib
    directory called neo-cron.xml ... this contains an entry for each
    scheduled task.
    I'd be very careful about making any changes to this file
    directly but take a look at it. Are your scheduled tasks
    duplicated? If so you can either remove the duplicates manually if
    you're feeling brave, or try deleting the scheduled tasks in the cf
    admin and then recreate them. Perhaps that would get rid of the
    duplicates. If you don't see dupliactes in this file then somehow
    ColdFusion's process that runs the scheduled tasks is probably
    running once for the old install and once for the new one.
    Sorry I don't have any more definitive info but hope this
    helps point you in the right direction.
    -Matt MacDougall

Maybe you are looking for

  • IPhone 4S doesn't ring all the time misses calls

    My phone is missing about 60% of the calls. Often it goes straight to message. More often it just doesn't ring. Very frustrating to miss so many calls.

  • Change/modify  Purchase info records (EINE table)

    Hi, Could you pls help to in providing FM to change/modify purchase info record. I have tried to use FM - >  ME_UPDATE_INFORECORD and ME_DB_UPDATE_INFORECORDS. but, it's not working . Kindly advice. Regards, Bharat

  • Non Financial Accounts,and Balance,Balance Recurring,Types of data and type

    Hi Can Any one make me clear for the following? 1.In HFM Account Types we can find Balance and Balance Recurring what it means? is it completely relating to Finance and Accounts Topics? if so give me few good examples to understand as regards to HFM

  • File content conversion at sender side

    Hi, I need to convert a flat file to xml at sender side using FCC. Input text file: Sunil,Chandra,Mumbai,400709 Sachin,Tendulkar,Delhi,110066 XML Structure   Occurrence >Employees     1..1   >  > Employee             0..N     > > > Fname         1..1

  • Itunes store does not display

    iTunes store icons do not display.  The play buttons for song on the right do not work.  Has anyone been able to figure this one out?