(SAP B1) - How to add user fields on Project Management? - project-management

I'am adding a project (OPMG) using the above code and it's working perfectly.
SAPbobsCOM.CompanyService oCompServ = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
SAPbobsCOM.ProjectManagementService pmgService = (SAPbobsCOM.ProjectManagementService)oCompServ.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementService);
SAPbobsCOM.PM_ProjectDocumentData project = (SAPbobsCOM.PM_ProjectDocumentData)pmgService.GetDataInterface(SAPbobsCOM.ProjectManagementServiceDataInterfaces.pmsPM_ProjectDocumentData);
project.ProjectName = "ProjectByDI_01";
project.Owner = 1;
project.StartDate = new DateTime(2016, 2, 1);
project.DueDate = new DateTime(2016, 11, 30);
project.ClosingDate = new DateTime(2016, 12, 31);
project.ProjectType = SAPbobsCOM.ProjectTypeEnum.pt_External;
project.BusinessPartner = "C20000";
project.ContactPerson = 2;
project.Territory = 1;
project.SalesEmployee = 5;
project.AllowSubprojects = SAPbobsCOM.BoYesNoEnum.tYES;
project.ProjectStatus = SAPbobsCOM.ProjectStatusTypeEnum.pst_Started;
project.FinancialProject = "PRJ01";
project.RiskLevel = SAPbobsCOM.RiskLevelTypeEnum.rlt_High;
project.Industry = 1;
project.Reason = "Test comment";
project.AttachmentEntry = 1;
pmgService.AddProject(project);
But now, i need to add an user field into that Project too. However I don't know how to do that, once there's no "UserField" properties on that object.
Is anybody pass through this situation?
Thanks in advance

I am not sure what SAP Business One version you are using but it must be version 9.2 or below.
User Defined Fields have been implemented for “PM_ProjectDocumentData”, “PM_StageData”, “PM_SubprojectDocumentData” for SAP Business One Version 9.3 PL01 and above.
For 9.3, "project.UserFields." will be exposed.
See link: https://blogs.sap.com/2016/07/28/project-management-object-is-exposed-from-sap-business-one-version-92-pl03/

Related

Issue in Facebook Replies download from post comments

I am trying to download public comments and replies from the FACEBOOK public post by page.
my code is working until 5 Feb'18, Now it is showing below error for the "Replies".
Error in data.frame(from_id = json$from$id, from_name = json$from$name, :
arguments imply differing number of rows: 0, 1
Called from: data.frame(from_id = json$from$id, from_name = json$from$name,
message = ifelse(!is.null(json$message), json$message, NA),
created_time = json$created_time, likes_count = json$like_count,
comments_count = json$comment_count, id = json$id, stringsAsFactors = F)
please refer below code I am using.
data_fun=function(II,JJ,page,my_oauth){
test <- list()
test.reply<- list()
for (i in II:length(page$id)){
test[[i]] <- getPost(post=page$id[i], token = my_oauth,n= 100000, comments = TRUE, likes = FALSE)
if (nrow(test[[i]][["comments"]]) > 0) {
write.csv(test[[i]], file = paste0(page$from_name[2],"_comments_", i, ".csv"), row.names = F)
for (j in JJ:length(test[[i]]$comments$id)){
test.reply[[j]] <-getCommentReplies(comment_id=test[[i]]$comments$id[j],token=my_oauth,n = 100000, replies = TRUE,likes = FALSE)
if (nrow(test.reply[[j]][["replies"]]) > 0) {
write.csv(test.reply[[j]], file = paste0(page$from_name[2],"_replies_",i,"_and_", j, ".csv"), row.names = F)
}}}
}
Sys.sleep(10)}
Thanks For Your support In advance.
I had the very same problem as Facebook changed the api rules at the end of January. If you update your package with 'devtools' from Pablo Barbera's github, it should work for you.
I have amended my code (a little) and it works fine now for replies to comments.There is one frustrating thing though, is that Facebook dont appear to allow one to extract the user name. I have a pool of data already so I am now using that to train and predict gender.
If you have any questions and want to make contact - drop me an email at 'robert.chestnutt2#mail.dcu.ie'
By the way - it may not be an issue for you, but I have had challenges in the past writing the Rfacebook output to a csv. Saving output as an .RData file maintains the form a lot better

gdata.data.PhoneNumber: How do I get the type of Phone Number?

Using the class gdata.data.PhoneNumber, how do I get the type (Home/Business/Mobile/etc.) of that phone number?
This is the documentation I am referencing: https://gdata-python-client.googlecode.com/hg/pydocs/gdata.data.html#PhoneNumber
The "rel" attribute should be what you are looking for.
This is example code from https://github.com/google/gdata-python-client/blob/master/tests/gdata_tests/contacts/service_test.py:
# Create a new entry
new_entry = gdata.contacts.ContactEntry()
new_entry.title = atom.Title(text='Elizabeth Bennet')
new_entry.content = atom.Content(text='Test Notes')
new_entry.email.append(gdata.contacts.Email(
rel='http://schemas.google.com/g/2005#work',
primary='true',
address='liz#gmail.com'))
new_entry.phone_number.append(gdata.contacts.PhoneNumber(
rel='http://schemas.google.com/g/2005#work', text='(206)555-1212'))
new_entry.organization = gdata.contacts.Organization(
org_name=gdata.contacts.OrgName(text='TestCo.'),
rel='http://schemas.google.com/g/2005#work')
It doesn't access the "rel" attribute but it is there, I swear :)
Once you get a PhoneNumer instance you can print every attribute with the built-in dir() function:
print(dir(phone_number))
The following is a list of "rel"s (https://github.com/google/gdata-python-client/blob/master/src/gdata/data.py). I don't know whether all are applicable to phone numbers or not but it may be useful for checking the type:
FAX_REL = 'http://schemas.google.com/g/2005#fax'
HOME_REL = 'http://schemas.google.com/g/2005#home'
HOME_FAX_REL = 'http://schemas.google.com/g/2005#home_fax'
ISDN_REL = 'http://schemas.google.com/g/2005#isdn'
MAIN_REL = 'http://schemas.google.com/g/2005#main'
MOBILE_REL = 'http://schemas.google.com/g/2005#mobile'
OTHER_REL = 'http://schemas.google.com/g/2005#other'
OTHER_FAX_REL = 'http://schemas.google.com/g/2005#other_fax'
PAGER_REL = 'http://schemas.google.com/g/2005#pager'
RADIO_REL = 'http://schemas.google.com/g/2005#radio'
TELEX_REL = 'http://schemas.google.com/g/2005#telex'
TTL_TDD_REL = 'http://schemas.google.com/g/2005#tty_tdd'
WORK_REL = 'http://schemas.google.com/g/2005#work'
WORK_FAX_REL = 'http://schemas.google.com/g/2005#work_fax'
WORK_MOBILE_REL = 'http://schemas.google.com/g/2005#work_mobile'
WORK_PAGER_REL = 'http://schemas.google.com/g/2005#work_pager'
NETMEETING_REL = 'http://schemas.google.com/g/2005#netmeeting'
Those OTHER "rel"s can (or maybe should?) be joined with the object's "label" attribute.

MP0303_SyncAssetEquipment - Commission Date field cannot be blank

I am getting the following error using infor-eam MP0303_SyncAssetEquipment:
"Commission Date field cannot be blank."
I have coded for the commission date:
getrequest.AssetEquipment.COMMISSIONDATE = new MP0303_SyncAssetEquipment_001.DATETIME();
getrequest.AssetEquipment.COMMISSIONDATE.YEAR = result.AssetEquipment.COMMISSIONDATE.YEAR;
getrequest.AssetEquipment.COMMISSIONDATE.MONTH = result.AssetEquipment.COMMISSIONDATE.MONTH;
getrequest.AssetEquipment.COMMISSIONDATE.DAY = result.AssetEquipment.COMMISSIONDATE.DAY;
getrequest.AssetEquipment.COMMISSIONDATE.HOUR = result.AssetEquipment.COMMISSIONDATE.HOUR;
getrequest.AssetEquipment.COMMISSIONDATE.MINUTE = result.AssetEquipment.COMMISSIONDATE.MINUTE;
getrequest.AssetEquipment.COMMISSIONDATE.SECOND = result.AssetEquipment.COMMISSIONDATE.SECOND;
getrequest.AssetEquipment.COMMISSIONDATE.SUBSECOND = result.AssetEquipment.COMMISSIONDATE.SUBSECOND;
getrequest.AssetEquipment.COMMISSIONDATE.TIMEZONE = result.AssetEquipment.COMMISSIONDATE.TIMEZONE;
But still getting the same error message. Any ideas?
Thanks Before Hand
You are missing these:
getrequest.AssetEquipment.COMMISSIONDATE.qualifier = new MP0303_SyncAssetEquipment_001.DATETIMEqual();
getrequest.AssetEquipment.COMMISSIONDATE.qualifier = (MP0303_SyncAssetEquipment_001.DATETIMEqual)result.AssetEquipment.COMMISSIONDATE.qualifier;

SharePoint 2013 - Sorting Search Results not working (KeywordQuery-SortList)

am using KeywordQuery to search and.. the SortList does not affect result, it is always return first 5 results. Any suggestion? The code is bellow...
using (KeywordQuery query = new KeywordQuery(site))
{
var fedManager = new FederationManager(application);
var owner = new SearchObjectOwner(SearchObjectLevel.SPSite, site.RootWeb);
query.SourceId = fedManager.GetSourceByName("NewsRS", owner).Id;
query.QueryText = string.Format("WorkflowStatusOWSCHCS:Approved PublishedUntilDate>=\"{0}\" OR NewsNewsPublishedDate<=\"{0}\"", DateTime.Now);
query.KeywordInclusion = KeywordInclusion.AllKeywords;
query.RowLimit = 5;
query.StartRow = 1;
query.SelectProperties.Add("NewsFriendlyUrl");
query.SelectProperties.Add("NewsNewsTeaser");
query.SelectProperties.Add("NewsNewsDate");
query.SelectProperties.Add("NewsPublishedUntilDate");
query.SelectProperties.Add("NewsNewsContent");
query.SelectProperties.Add("NewsNewsPublishedDate");
query.SelectProperties.Add("NewsNewsImage");
query.SortList.Add("NewsNewsDate", SortDirection.Descending);
var searchExecutor = new SearchExecutor();
var myResults = searchExecutor.ExecuteQuery(query);
}
}
... the NewsNewsDate is marked as Sortable
query.RowLimit = 5; => You are explicitly specifying the Rowlimit to be 5. That is why it returns the first 5 results always. Change the rowlimit and set it to the number of results you need.

How to set the "Plan Work" (EstimatedHours) for a Task in StarTeam SDK?

I can't figure out how to set the EstimatedHours property from the StarTeam SDK. The property EstimatedHours is readonly, and I can't figure out any way to set the value from the SDK, though through the UI you can set the "Plan, Work" field.
Setting the EstimatedStart/Finish doesn't work:
var task = new Borland.StarTeam.Task(cr.ParentFolder);
task.Name = "Name";
task.Notes = "Notes";
// task.EstimatedHours = 4.0; // readonly property
task.EstimatedStart = DateTime.Now;
task.EstimatedFinish = DateTime.Now.AddHours(4);
task.Update();
The only way I have figured out to set the Estimated Hours was with database access and a SQL query:
UPDATE t
SET StTaskEstimatedHours = 4
FROM dbo.syn_Task t
WHERE t.EndModifiedTime = 0 AND t.DeletedTime = 0
AND t.StTaskNumber = {task.Number}

Resources