Quantcast
Viewing all articles
Browse latest Browse all 5347

CSOM - check if resource custom field row exist and create new row

does anyone know how to use CSOMto check if resource custom field row exist and create new row ?

i have code that will update a custom field for a resource if the row already there, but it doesnt work if its a new resource and custom field row doesnt exist yet. here is what i have so far. 

CustomField cfPersonType;

String cfPersonTypeInternalName;

 foreach (EnterpriseResource rs in projContext.EnterpriseResources)
            {
                foreach (DataRow row in OracleTable.Rows)
                {      

                            cfPersonType = customFields.First(c => c.Name == "Resource_HR_Person_Type");

                            cfPersonTypeInternalName = cfPersonType.InternalName;

                            //update person type
                            if (rs[cfPersonTypeInternalName].ToString() != row["hr_person_type"].ToString())
                            {
                                rs[cfPersonTypeInternalName] = row["hr_person_type"].ToString();

                                Console.WriteLine("Person type set to " + row["hr_person_type"].ToString());


  


tatiana




Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>