I have a Nintex workflow and I am using a "Call Web Service" action to add a new list item in another site. I want to update a lookup field in the destination list from a lookup field in the source list. This is my CAML query
<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>Kaizen Blast Objectives</listName>
<updates>
<Batch OnError="Continue" ListVersion="1" ViewName="">
<Method ID="1" Cmd="New">
<Field Name="ID">New</Field>
<Field Name="Title">{ItemProperty:Title}</Field>
<Field Name="Event_x0020_Driver">{ItemProperty:Event_x0020_Driver}</Field>
<Field Name="Problem_x0020_Statement">{ItemProperty:Problem_x0020_Statement}</Field>
<Field Name="Group1">{ItemProperty:Group}</Field>
</Method>
</Batch>
</updates>
</UpdateListItems>
"Group1" is a lookup field in the destination list and "Group" ({ItemProperty:Group}) is a lookup field in the source list.
A simple assignment like I have doesn't seem to work.
EDIT
The lookup field in the destination list is a site column.
Any ideas?
I figured it out. When updating a lookup field the format has to be id;#value. This is true even if the source and the destination fields are of the same data type.
Related
I have a custom odoo module, which extends some existing modules like hr. I want to create an onboarding plan with several predefined tasks in it.
This is my plan acitivity type xml which works at it should. If I update the applikation with this file, I get the desired tasks in the planning types overview.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hr_plan_activity_type_create_work_contract" model="hr.plan.activity.type">
<field name="activity_type_id" ref="mail.mail_activity_data_todo"/>
<field name="responsible">manager</field>
<field name="summary">Create work contract</field>
<field name="note">Create the work contract for the employee.</field>
</record>
<record id="hr_plan_activity_type_employee_model_in_erp" model="hr.plan.activity.type">
<field name="activity_type_id" ref="mail.mail_activity_data_todo"/>
<field name="responsible">manager</field>
<field name="summary">Employee model in ERP</field>
<field name="note">Complete the employee model in ERP (AHV, Banking, etc.)</field>
</record>
</odoo>
This is my plan.xml which should create a plan with the activity types. The creation of the plan works, but if I reference the activity types, I'll get an error message.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Onboarding -->
<record id="hr_plan_onboarding" model="hr.plan">
<field name="name">Onboarding</field>
<field name="plan_activity_type_ids"
eval="[(6,0,[ref('mycompany.hr_plan_activity_type_employee_model_in_erp')])]"/>
<field name="plan_activity_type_ids"
eval="[(4,0,[ref('mycompany.hr_plan_activity_type_create_work_contract')])]"/>
</record>
</odoo>
In the manifest.py file I first load the plan.activity.type.xml and then the plan.xml so this shouldn't be a problem.
This is the error message I get when I try to upgrade my customized module mycompany:
File "C:\Program Files (x86)\Odoo 13.0e\server\odoo\addons\base\models\ir_model.py", line 1670, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
odoo.tools.convert.ParseError: "External ID not found in the system: hr.plan.activity.type.hr_plan_activity_type_create_work_contract" while parsing file:/c:/users/myuser/appdata/local/openerp%20s.a/odoo/addons/13.0/mycompany/data/hr/plan.xml:2, near
<odoo>
<!-- Onboarding -->
<record id="hr_plan_onboarding" model="hr.plan">
<field name="name">Onboarding</field>
<field name="plan_activity_type_ids" ref="hr.plan.activity.type.hr_plan_activity_type_create_work_contract"/>
</record>
Does anyone have any ideas?
String identifier stored in ir.model.data, can be used to refer to a record regardless of its database identifier during data imports or export/import roundtrips.
External identifiers are in the form module.id (e.g. account.invoice_graph). From within a module, the module. prefix can be left out.
Sometimes referred to as xml id or xml_id as XML-based Data Files make extensive use of them.
In your example you used model_name.id which probably does not exist in the database, to reference hr_plan_activity_type_create_work_contract record you just need to replace the model name with the module name.
I can see from the log message that the module name is mycompany, try to replace the model name with mycompany:
<record id="hr_plan_onboarding" model="hr.plan">
<field name="name">Onboarding</field>
<field name="plan_activity_type_ids" ref="mycompany.hr_plan_activity_type_create_work_contract"/>
</record>
Update:plan_activity_type_ids is an x2many field
Use the special commands format to set the x2many field values:
<record id="hr_plan_onboarding" model="hr.plan">
<field name="name">Onboarding</field>
<field name="plan_activity_type_ids" eval="[(6,0,[ref('mycompany.hr_plan_activity_type_create_work_contract')])]"/>
</record>
Edit: Only the first one shows up in the GUI
To replaces all existing records in the set by the ids list (using '(6, 0, ids)') you can provide a list of ids inside the triplet. You can find an example in res_partner_demo.xml inside the base module.
Example:
<field name="plan_activity_type_ids" eval="[(6,0,[ref('mycompany.hr_plan_activity_type_employee_model_in_erp'), ref('mycompany.hr_plan_activity_type_create_work_contract')])]"/>
To add an existing record of id id to the set (using (4, id)) you need to provide one id for each triplet. You can find an example in base_groups.xml inside the base module.
Example:
<field name="plan_activity_type_ids" eval="[(4,ref('mycompany.hr_plan_activity_type_employee_model_in_erp')), (4,ref('mycompany.hr_plan_activity_type_create_work_contract'))]"/>
Your ref ids are wrong. hr.plan.activity.type.hr_plan_activity_type_create_work_contract is wrong. You get only one . in a reference. its [<module_name>.]ext_id_of_object.
If you reference the object from the same module you don't have to use module name.part
If you can see the database tables. then things you are referencing are in table ir_model_data
So if the thing you are referencing is in your own model then you cant use just hr_plan_activity_type_create_work_contract as a reference or your_model_name.hr_plan_activity_type_create_work_contract
I created a module for managing employee resume in Odoo. Employees will fill their work_experience, education, technology-wise experience, etc. I wanted to make the search view search for all these parameters. The technology-wise Experience here is a One2Many field. I wanted to search this field based on both the parameter together (i.e experience and technology). Please help me find a way to do this.
In Model
technology_experience =
fields.One2many("hr.employee.work.technology.experience",
inverse_name='resume_id', string='Technology Experience')
In view
`<field name="technology_experience">
<tree editable="bottom" create="0">
<field name="name" required="1"/>
<field name="experience" required="1"/>
</tree>
</field>
`
I'm making a study to compare different search platforms' performance over Twitter's tweets. For my purpose I have collected a set of tweets (around 50,000) and saved them in a single text (.txt) file in a format similar to the following:
Tweet ID User Tweet Content Tweet Time-stamp
The data would look like this:
31261817690923008 username1 tweet 1 content goes here 1482180069
31132193287839744 username2 tweet 2 content goes here 1274400000
Now, using Solr 6.3.0, is it possible to index each line of content separately? Instead, should I use XML or JSON? or do I have to store each line (tweet) in a different file?
You can use the CSV Update Handler, which will result in a single document for each row.
To adjust the parsing to the structure you've used, you can use separator (TAB? %09) to provide the separator used between fields / columns, encapsulator to set the value used to encapsulate a single field value (it doesn't seem you've used any) and fieldnames to provide a proper field name for each column, unless they're in the first row - in that case set header to true (and don't provide fieldnames).
Assuming two things:
#1 You do not want to do an awful lot of coding for the data entry.
#2 Your text file is TAB or comma separated.
If so, you can easily turn it into an XML that can be added via the Admin interface.
A few things to keep in mind:
Enclose your data in <add> ... </add> blocks of a reasonable size. Ideally not 50K. Experiment a little.
Enclose each entry - line in your case in <doc> ... <doc>
Each column needs to have its own field as in
<field name="id"> ... </field>
<field name="username"> ... </field>
...
All need unique IDs.
For practical purposes, if you can open the textfile in a spreadsheet, add the tag columns in between your data and then concatenate the lines, it is relatively easy even if a little labour intensive for 50K.
A doc set of two would look something like:
<add>
<doc>
<field name="id"> ... </field>
<field name="user"> ... </field>
<field name="content"> ... </field>
<field name="time_stamp"> ... </field>
</doc>
<doc>
<field name="id"> ... </field>
<field name="user"> ... </field>
<field name="content"> ... </field>
<field name="time_stamp"> ... </field>
</doc>
</add>
Hello i've read the Solr wiki and searched here but didn't find a solution for my use-case:
We're indexing customer-data with different kind of contracts into a single document.
So each customer will result in a Solr document witth one or more different contracts.
The fields for each contract are added dynamically via import (e.g. contract_type_1_s, contract_type_2_s, ...; contract_change_date_1_dt, contract_change_date_2_dt, ...). So all fields with '2' are related to contract no 2.
With this the user is able to search for customers who have a contract of type one and none of type two and so on.
My use case is now to return only the fields of the contract which matched the query.
Here's an example:
<doc>
<field name="id">100</field>
<field name="customer_name">paul</field>
<field name="contract_type_1_s">inhouse</field>
<field name="contract_change_date_1_dt">2012-09-01T00:00:00Z</field>
</doc>
<doc>
<field name="id">101</field>
<field name="customer_name">fred</field>
<field name="contract_type_1_s">inhouse</field>
<field name="contract_change_date_1_dt">2012-09-01T00:00:00Z</field>
<field name="contract_type_2_s">external</field>
<field name="contract_change_date_2_dt">2012-09-01T00:00:00Z</field>
</doc>
<doc>
<field name="id">102</field>
<field name="customer_name">karl</field>
<field name="contract_type_1_s">external</field>
<field name="contract_change_date_1_dt">2012-09-01T00:00:00Z</field>
<field name="contract_type_2_s">inhouse</field>
<field name="contract_change_date_2_dt">2012-09-01T00:00:00Z</field>
</doc>
If the user now searches for customers with contract-type 'external' the documents with ids 101 and 102 are in the result. Now i want to return different fields of the contract which matched the query.
In this example these should be contract_change_date_1_dt for document 102 and contract_change_date_2_dt for document 101, since contract no 1 is external in document 102 and contract no 2 is external in document 101.
Is there a way to achive this behavior with build-in components?
I know that i can find out which fields matched the query with the highlight-component.
I endet up with following resolution, but it forces me to extend Solr:
Write a QParser to to identify needet fields, add them to the fl-param
Do a Highlighting-Query before returning the results to the Client
Iterate over all docs in result and add the fields which matched the query per doc into the result list
I Hope i made my problem clear. Any suggestions which is a good way to archive this are really appreciated.
greetings René
if someone needs a similar thing ;-)
I now managed to build up my custom result list in the following way:
Create a Custom QueryComponent (extending standard QueryComponent) to store the fields which are used in the query. In the prepare-method activate highlighting with the stored fields:
// Making params modifieable
ModifiableSolrParams modifiableParams = new ModifiableSolrParams(params);
req.setParams(modifiableParams);
modifiableParams.set(HighlightParams.FIELDS, queryFieldList);
modifiableParams.set(HighlightParams.HIGHLIGHT, "true");
modifiableParams.set(HighlightParams.FIELD_MATCH, "true");
modifiableParams.set(HighlightParams.SIMPLE_PRE, "");
modifiableParams.set(HighlightParams.SIMPLE_POST, "");
Create a Custom HighlightComponent (extending standard HighlightComponent) to build the result out of the std. result. In the process-method i now get the highlight info and extract the information i need:
NamedList<Object> rspValues = rb.rsp.getValues();
NamedList<Object> nlHl = (NamedList<Object>) rspValues.get("highlighting");
this.hlDocsAndFields = extractHighlightingInfo(nlHl);
For that i created a custom List, which is able to count the matches per contract (how much fields of contract_X_s are in the highlighted results).
This works fine.
I now stuck at the response writer who resolves the document-fields himself when he builds the response :-(
Has annyone a suggestion on changig/customizing the response writer?
greetings René
I now managed the whole thing.
I must not change the response writer at all :-)
I just had to store all fields which i resolved for each document and add them to the response:
rb.rsp.setReturnFields(globalResultFields);
greetings René
I'm new to Apache Solr. Even after reading the documentation part, I'm finding it difficult to clearly understand the functionality and use of the multiValued field type property.
What internally Solr does/treats/handles a field that is marked as multiValued?
What is the difference in indexing in Solr between a field that is multiValued and those that are not?
Can somebody explain with some good example?
Doc says:
multiValued=true|false
True if this
field may contain multiple values per
document, i.e. if it can appear
multiple times in a document
A multivalued field is useful when there are more than one value present for the field. An easy example would be tags, there can be multiple tags that need to be indexed. so if we have tags field as multivalued then solr response will return a list instead of a string value. One point to note is that you need to submit multiple lines for each value of the tags like:
<field name="tags">tag1</tags>
<field name="tags">tag2</tags>
...
<field name="tags">tagn</tags>
Once you have all the values index you can search or filter results by any value, e,g. you can find all documents with tag1 using query like
q=tags:tag1
or use the tags to filter out results like
q=query&fq=tags:tag1
multiValued defined in the schema whether the field is allowed to have more than one value.
For instance:
if I have a fieldType called ID which is multiValued=false indexing a document such as this:
doc {
id : [ 1, 2]
...
}
would cause an exception to be thrown in the indexing thread and the document will not be indexed (schema validation will fail).
On the other hand if I do have multiple values for a field I would want to set multiValued=true in order to guarantee that indexing is done correctly, for example:
doc {
id : 1
keywords: [ hello, world ]
...
}
In this case you would define "keywords" as a multiValued field.
I use multiple value fields only with copyfields, so think this way, say all fields will be single valued unless it's a copyfield, for example I have following fields:
<field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="string" indexed="true" stored="true"/>
<field name="subject" type="string" indexed="true" stored="true"/>
<field name="location" type="string" indexed="true" stored="true"/>
I want to query one field only and possibly to search all 4 fields above, then we need to use copyfield. first to create a new field call 'all', then copy everything into 'all'
<field name="all" type="text" indexed="true" stored="true" multiValued="true"/>
<copyField source="*" dest="all"/>
Now field 'all' need to be multi-valued.