Error in Script Task in Business Process

Hello!

I'm trying to make an integration with a digital signature call "Firmamex" and I trying to use the code that they provide in their SDK in a business process but i have error messages that dont let me publish the script task. 

This are the errors 

 

And this is the source code of the process. I already try to put a return true; at the end of the script task but stills send me the error. 

 

I hope you can help me.

 

namespace Terrasoft.Core.Process
{
 
    using Newtonsoft.Json;
    using SignmageSDK;
    using SignmageSDKCore;
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Drawing;
    using System.Globalization;
    using System.Text;
    using System.Web;
    using Terrasoft.Common;
    using Terrasoft.Configuration;
    using Terrasoft.Core;
    using Terrasoft.Core.Configuration;
    using Terrasoft.Core.DB;
    using Terrasoft.Core.Entities;
    using Terrasoft.Core.Process;
    using Terrasoft.Core.Process.Configuration;
 
    #region Class: UsrfirmamexMethodsWrapper
 
    /// <exclude/>
    public class UsrfirmamexMethodsWrapper : ProcessModel
    {
 
        public UsrfirmamexMethodsWrapper(Process process)
            : base(process) {
            AddScriptTaskMethod("ScriptTask1Execute", ScriptTask1Execute);
        }
 
        #region Methods: Private
 
        private bool ScriptTask1Execute(ProcessExecutingContext context) {
            }
            public class Flow
                {
                    SignmageSDK.FirmamexServices signmageServices;
                    String base64;
                    String name;
 
                    public Flow(SignmageSDK.FirmamexServices signmageServices, String base64, String name)
                    {
                        this.signmageServices = signmageServices;
                        this.base64 = base64;
                        this.name = name;
                    }
 
                    public String request()
                    {
                        B64_doc b64_doc = new B64_doc { name = name, data = base64 };
 
                        JObject flujoEjemplo = JObject.FromObject(new
                        {
                            b64_doc = b64_doc,
                            stickers = new object[] {
                                new {
                                    authority = "SAT",
                                    stickerType = "line",
                                    dataType = "rfc",
                                    data = "ARCX9012226P8",
                                    imageType = "hash",
                                    email = "jhon@gmail.com",
                                    page = "0",
                                    rect = new Rect { lx = 226.45f, ly = 355.25f, tx = 397.75f, ty = 413.85f }
                                }
                            },
                            workflow = new object[] {
                                new {
                                    data = "ARCX9012226P8"
                                }
                            },
                            app2 = true
                        });
 
                        String flujoParams = flujoEjemplo.ToString(Formatting.None);
                        return signmageServices.request(flujoParams);
                    }
                }
            };
        }
 
        #endregion
 
    }
 
    #endregion
 
}
Like 0

Like

2 comments

Hello Laura,
Thank you for your question.

I have some updates regarding you issue. 

First of all, indeed the generated code contains errors in lines 88 and 92 due to #endregion directives are being set in the wrong place.
1

Secondly, if you have a script task in your business process you might want to return a bool value inside it because the body of the script task if actually a body of a generated method (in your case ScriptTask1Execute).


Thirdly, it is impossible from my side to verify implementation of third-party code so i am unable to state that the code you provided will work. 

Lastly, if you have multiple versions of your business process that contain compilation errors, it is recommended to either correct them in all versions or delete them in the Configuration section of your application.

Hello Yevhenii Grytsiuk,

 

After the comments you left me, I have made some changes.

I have tried to place a return bool but every time I place it I get another error, so I have omitted it in order to be able to test if the script works. 
However, despite my attempts I still cannot remove this error "Type or namespace definition, or end-of-file expected"
It doesn't allow me to move the #endregion around, and even if I move the brackets it leaves it the same. In fact, that part is placed automatically when publishing the script, so I don't know how to move it so that I can stop having the error. 
If you have any idea on how to move it to remove the error, I would greatly appreciate it if you shared it with me.

Show all comments