Create recipe by function and modify the new recipe in C#

Create recipe by function and modify the new recipe in C#

Hi, I would like to create a recipe using a function and edit it in C# right after creating it. Creating the recipe by function works using the following command:
C# Code:
this.RtFunctions().Item("Function_Recipe_Offline_Save_As").Start();
Modifying an existing recipe works as well using the following code:
C# Code:
zenOn.IRGMRecipeGroups zRGM; zRGM = this.RGMGroups(); zenOn.IRGMRecipeGroup zRecipeGroup = zRGM.Item("Product_Data"); zenOn.IRGMRecipe zRecipe;zRecipe = zRecipeGroup.RecipeItem("RecipeName"); zRecipe.set_DynProperties("RecipeNumber", RequestedID); zRecipe.ValueItem(1).set_DynProperties("Type", 2); zRecipe.ValueItem(1).set_DynProperties("StringValue", RequestedName); zRecipe.ValueItem(2).set_DynProperties("Type", 2); zRecipe.ValueItem(2).set_DynProperties("Value", RequestedID); zRecipe.Save();
In both cases the Recept Name comes from a PopUp, that means the name is known in the Project. Instead of the string "RecipeName" it would be a variable RequestedName. What doesn't work is to create and change the Receptes in one step. Apparently the currently created Recept is not available yet? Is there someting to be updated? Does anyone have an idea how I can realize this?

This is a migrated post! Originally posted on 26.04.2019 by user StephanJ. Please be aware that information can be outdated.