//Lead entity protected override void Execute(CodeActivityContext executionContext) { ITracingService tracingService = executionContext.GetExtension <ITracingService>(); //Create the context IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); string ipaddress = Ip.Get(executionContext); var url = "http://api.ipstack.com/" + ipaddress + "?access_key=bdabebdf8e4b43763d51c4a88401e22f"; WebClient w = new System.Net.WebClient(); string jsonResponse = w.DownloadString(url); Location location = JSONSerializer <Location> .DeSerialize(jsonResponse); Countryname.Set(executionContext, location.country_name); Cityname.Set(executionContext, location.city); }