Hey
so my custom library assembly makes a post to UKG and needs an async Task to do that. The Task has a return value of success or fail from the endpoint REST service.
If i dont use the async & awaits, the code deadlocks.
Im able to reg results in Visual Studio because i can call the code with await but i cant seem to do the same with Epicor. Here is my code
Main() in Library
public async Task<string> Main()
{
//call for a token
var token = await ApiClient.GetAccessToken(username, password, clientId, clientSecret, urlToken);
//Post the data if a token is received
if (token != null)
{
var result = await ApiClient.PostJsonData(token, dt, urlPost);
string res = result + $" with token '{token}'";
return res;
}
else
{
return token;
}
}
Caller in test project (Visual Studio)
EpiTo epiTo = new EpiTo(username, password, clientID, clientSecret, urlToken, urlpost, dt);
submit(epiTo);
private async void submit(EpiTo epiTo)
{
string Result = await epiTo.Main();
txtPostResult.Text = Result;
}
How can i call the library method Main()) and get the return result back? Its works as expected in VS
Thanks